programmer's documentation
cs_convection_diffusion.h
Go to the documentation of this file.
1 #ifndef __CS_CONVECTION_DIFFUSION_H__
2 #define __CS_CONVECTION_DIFFUSION_H__
3 
4 /*============================================================================
5  * Convection-diffusion operators.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 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 grdpai,
178  const cs_real_33_t grdpaj,
179  const cs_real_t i_massflux,
180  cs_real_t testij[3],
181  cs_real_t tesqck[3])
182 {
183  double testi[3], testj[3];
184  double dcc[3], ddi[3], ddj[3];
185 
186  /* Slope test
187  ----------*/
188  for (int isou = 0; isou < 3; isou++) {
189  testi[isou] = grdpai[isou][0]*i_face_normal[0]
190  + grdpai[isou][1]*i_face_normal[1]
191  + grdpai[isou][2]*i_face_normal[2];
192  testj[isou] = grdpaj[isou][0]*i_face_normal[0]
193  + grdpaj[isou][1]*i_face_normal[1]
194  + grdpaj[isou][2]*i_face_normal[2];
195  testij[isou] = grdpai[isou][0]*grdpaj[isou][0]
196  + grdpai[isou][1]*grdpaj[isou][1]
197  + grdpai[isou][2]*grdpaj[isou][2];
198 
199  if (i_massflux>0.) {
200  dcc[isou] = gradi[isou][0]*i_face_normal[0]
201  + gradi[isou][1]*i_face_normal[1]
202  + gradi[isou][2]*i_face_normal[2];
203  ddi[isou] = testi[isou];
204  ddj[isou] = (pj[isou]-pi[isou])/distf *srfan;
205  } else {
206  dcc[isou] = gradj[isou][0]*i_face_normal[0]
207  + gradj[isou][1]*i_face_normal[1]
208  + gradj[isou][2]*i_face_normal[2];
209  ddi[isou] = (pj[isou]-pi[isou])/distf *srfan;
210  ddj[isou] = testj[isou];
211  }
212  tesqck[isou] = cs_math_sq(dcc[isou]) - cs_math_sq(ddi[isou]-ddj[isou]);
213  }
214 }
215 
216 /*----------------------------------------------------------------------------*/
233 /*----------------------------------------------------------------------------*/
234 
235 inline static void
237  const cs_real_6_t pj,
238  const cs_real_t distf,
239  const cs_real_t srfan,
240  const cs_real_3_t i_face_normal,
241  const cs_real_63_t gradi,
242  const cs_real_63_t gradj,
243  const cs_real_63_t grdpai,
244  const cs_real_63_t grdpaj,
245  const cs_real_t i_massflux,
246  cs_real_t testij[6],
247  cs_real_t tesqck[6])
248 {
249  double testi[6], testj[6];
250  double dcc[6], ddi[6], ddj[6];
251 
252  /* Slope test */
253 
254  for (int isou = 0; isou < 6; isou++) {
255  testi[isou] = grdpai[isou][0]*i_face_normal[0]
256  + grdpai[isou][1]*i_face_normal[1]
257  + grdpai[isou][2]*i_face_normal[2];
258  testj[isou] = grdpaj[isou][0]*i_face_normal[0]
259  + grdpaj[isou][1]*i_face_normal[1]
260  + grdpaj[isou][2]*i_face_normal[2];
261  testij[isou] = grdpai[isou][0]*grdpaj[isou][0]
262  + grdpai[isou][1]*grdpaj[isou][1]
263  + grdpai[isou][2]*grdpaj[isou][2];
264 
265  if (i_massflux>0.) {
266  dcc[isou] = gradi[isou][0]*i_face_normal[0]
267  + gradi[isou][1]*i_face_normal[1]
268  + gradi[isou][2]*i_face_normal[2];
269  ddi[isou] = testi[isou];
270  ddj[isou] = (pj[isou]-pi[isou])/distf *srfan;
271  } else {
272  dcc[isou] = gradj[isou][0]*i_face_normal[0]
273  + gradj[isou][1]*i_face_normal[1]
274  + gradj[isou][2]*i_face_normal[2];
275  ddi[isou] = (pj[isou]-pi[isou])/distf *srfan;
276  ddj[isou] = testj[isou];
277  }
278  tesqck[isou] = cs_math_sq(dcc[isou]) - cs_math_sq(ddi[isou]-ddj[isou]);
279  }
280 }
281 
282 /*----------------------------------------------------------------------------*/
301 /*----------------------------------------------------------------------------*/
302 
303 inline static void
304 cs_i_compute_quantities(const int ircflp,
305  const double pnd,
306  const cs_real_3_t cell_ceni,
307  const cs_real_3_t cell_cenj,
308  const cs_real_3_t i_face_cog,
309  const cs_real_3_t dijpf,
310  const cs_real_3_t gradi,
311  const cs_real_3_t gradj,
312  const cs_real_t pi,
313  const cs_real_t pj,
314  cs_real_t *recoi,
315  cs_real_t *recoj,
316  cs_real_t *pip,
317  cs_real_t *pjp)
318 {
319  cs_real_t diipfx, diipfy, diipfz, djjpfx, djjpfy, djjpfz;
320  cs_real_t dpxf, dpyf, dpzf;//FIXME
321 
322  /* Recompute II' and JJ' at this level */
323 
324  diipfx = i_face_cog[0] - (cell_ceni[0] + (1.-pnd) * dijpf[0]);
325  diipfy = i_face_cog[1] - (cell_ceni[1] + (1.-pnd) * dijpf[1]);
326  diipfz = i_face_cog[2] - (cell_ceni[2] + (1.-pnd) * dijpf[2]);
327 
328  djjpfx = i_face_cog[0] - cell_cenj[0] + pnd * dijpf[0];
329  djjpfy = i_face_cog[1] - cell_cenj[1] + pnd * dijpf[1];
330  djjpfz = i_face_cog[2] - cell_cenj[2] + pnd * dijpf[2];
331 
332  dpxf = 0.5*(gradi[0] + gradj[0]);
333  dpyf = 0.5*(gradi[1] + gradj[1]);
334  dpzf = 0.5*(gradi[2] + gradj[2]);
335 
336  /* reconstruction only if IRCFLP = 1 */
337  *recoi = ircflp*(dpxf*diipfx+dpyf*diipfy+dpzf*diipfz);
338  *recoj = ircflp*(dpxf*djjpfx+dpyf*djjpfy+dpzf*djjpfz);
339  *pip = pi + *recoi;
340  *pjp = pj + *recoj;
341 }
342 
343 /*----------------------------------------------------------------------------*/
362 /*----------------------------------------------------------------------------*/
363 
364 inline static void
366  const double pnd,
367  const cs_real_3_t cell_ceni,
368  const cs_real_3_t cell_cenj,
369  const cs_real_3_t i_face_cog,
370  const cs_real_3_t dijpf,
371  const cs_real_33_t gradi,
372  const cs_real_33_t gradj,
373  const cs_real_3_t pi,
374  const cs_real_3_t pj,
375  cs_real_t recoi[3],
376  cs_real_t recoj[3],
377  cs_real_t pip[3],
378  cs_real_t pjp[3])
379 {
380  cs_real_3_t dijpfv, diipfv, djjpfv;
381  cs_real_3_t dpvf;
382 
383  for (int jsou = 0; jsou < 3; jsou++)
384  dijpfv[jsou] = dijpf[jsou];
385 
386  /* Recompute II' and JJ' at this level */
387  for (int jsou = 0; jsou < 3; jsou++) {
388  diipfv[jsou] = i_face_cog[jsou]
389  - (cell_ceni[jsou] + (1.-pnd) * dijpfv[jsou]);
390  djjpfv[jsou] = i_face_cog[jsou]
391  - cell_cenj[jsou] + pnd * dijpfv[jsou];
392  }
393 
394  /* x-y-z components, p = u, v, w */
395 
396  for (int isou = 0; isou < 3; isou++) {
397 
398  for (int jsou = 0; jsou < 3; jsou++)
399  dpvf[jsou] = 0.5*( gradi[isou][jsou]
400  + gradj[isou][jsou]);
401 
402  /* reconstruction only if IRCFLP = 1 */
403 
404  recoi[isou] = ircflp*( dpvf[0]*diipfv[0]
405  + dpvf[1]*diipfv[1]
406  + dpvf[2]*diipfv[2]);
407 
408 
409  recoj[isou] = ircflp*( dpvf[0]*djjpfv[0]
410  + dpvf[1]*djjpfv[1]
411  + dpvf[2]*djjpfv[2]);
412 
413  pip[isou] = pi[isou] + recoi[isou];
414 
415  pjp[isou] = pj[isou] + recoj[isou];
416 
417  }
418 }
419 
420 /*----------------------------------------------------------------------------*/
439 /*----------------------------------------------------------------------------*/
440 
441 inline static void
443  const double pnd,
444  const cs_real_3_t cell_ceni,
445  const cs_real_3_t cell_cenj,
446  const cs_real_3_t i_face_cog,
447  const cs_real_3_t dijpf,
448  const cs_real_63_t gradi,
449  const cs_real_63_t gradj,
450  const cs_real_6_t pi,
451  const cs_real_6_t pj,
452  cs_real_t recoi[6],
453  cs_real_t recoj[6],
454  cs_real_t pip[6],
455  cs_real_t pjp[6])
456 {
457  cs_real_3_t dijpfv, diipfv, djjpfv;
458  cs_real_3_t dpvf;
459 
460  for (int jsou = 0; jsou < 3; jsou++)
461  dijpfv[jsou] = dijpf[jsou];
462 
463  /* Recompute II' and JJ' at this level */
464 
465  for (int jsou = 0; jsou < 3; jsou++) {
466  diipfv[jsou] = i_face_cog[jsou]
467  - (cell_ceni[jsou] + (1.-pnd) * dijpfv[jsou]);
468  djjpfv[jsou] = i_face_cog[jsou]
469  - cell_cenj[jsou] + pnd * dijpfv[jsou];
470  }
471 
472  /* x-y-z components, p = u, v, w */
473 
474  for (int isou = 0; isou < 6; isou++) {
475 
476  for (int jsou = 0; jsou < 3; jsou++)
477  dpvf[jsou] = 0.5*( gradi[isou][jsou]
478  + gradj[isou][jsou]);
479 
480  /* reconstruction only if IRCFLP = 1 */
481 
482  recoi[isou] = ircflp*( dpvf[0]*diipfv[0]
483  + dpvf[1]*diipfv[1]
484  + dpvf[2]*diipfv[2]);
485 
486 
487  recoj[isou] = ircflp*( dpvf[0]*djjpfv[0]
488  + dpvf[1]*djjpfv[1]
489  + dpvf[2]*djjpfv[2]);
490 
491  pip[isou] = pi[isou] + recoi[isou];
492 
493  pjp[isou] = pj[isou] + recoj[isou];
494 
495  }
496 }
497 
498 /*----------------------------------------------------------------------------*/
514 /*----------------------------------------------------------------------------*/
515 
516 inline static void
517 cs_i_relax_c_val(const double relaxp,
518  const cs_real_t pia,
519  const cs_real_t pja,
520  const cs_real_t recoi,
521  const cs_real_t recoj,
522  const cs_real_t pi,
523  const cs_real_t pj,
524  cs_real_t *pir,
525  cs_real_t *pjr,
526  cs_real_t *pipr,
527  cs_real_t *pjpr)
528 {
529  *pir = pi/relaxp - (1.-relaxp)/relaxp * pia;
530  *pjr = pj/relaxp - (1.-relaxp)/relaxp * pja;
531 
532  *pipr = *pir + recoi;
533  *pjpr = *pjr + recoj;
534 }
535 
536 /*----------------------------------------------------------------------------*/
552 /*----------------------------------------------------------------------------*/
553 
554 inline static void
555 cs_i_relax_c_val_vector(const double relaxp,
556  const cs_real_3_t pia,
557  const cs_real_3_t pja,
558  const cs_real_3_t recoi,
559  const cs_real_3_t recoj,
560  const cs_real_3_t pi,
561  const cs_real_3_t pj,
562  cs_real_t pir[3],
563  cs_real_t pjr[3],
564  cs_real_t pipr[3],
565  cs_real_t pjpr[3])
566 {
567  for (int isou = 0; isou < 3; isou++) {
568  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
569  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
570 
571  pipr[isou] = pir[isou] + recoi[isou];
572  pjpr[isou] = pjr[isou] + recoj[isou];
573  }
574 }
575 
576 /*----------------------------------------------------------------------------*/
592 /*----------------------------------------------------------------------------*/
593 
594 inline static void
595 cs_i_relax_c_val_tensor(const double relaxp,
596  const cs_real_6_t pia,
597  const cs_real_6_t pja,
598  const cs_real_6_t recoi,
599  const cs_real_6_t recoj,
600  const cs_real_6_t pi,
601  const cs_real_6_t pj,
602  cs_real_t pir[6],
603  cs_real_t pjr[6],
604  cs_real_t pipr[6],
605  cs_real_t pjpr[6])
606 {
607  for (int isou = 0; isou < 6; isou++) {
608  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
609  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
610 
611  pipr[isou] = pir[isou] + recoi[isou];
612  pjpr[isou] = pjr[isou] + recoj[isou];
613  }
614 }
615 
616 /*----------------------------------------------------------------------------*/
623 /*----------------------------------------------------------------------------*/
624 
625 inline static void
627  cs_real_t *pf)
628 {
629  *pf = p;
630 }
631 
632 /*----------------------------------------------------------------------------*/
639 /*----------------------------------------------------------------------------*/
640 
641 inline static void
643  cs_real_t pf[3])
644 {
645  for (int isou = 0; isou < 3; isou++)
646  pf[isou] = p[isou];
647 }
648 
649 /*----------------------------------------------------------------------------*/
656 /*----------------------------------------------------------------------------*/
657 
658 inline static void
660  cs_real_t pf[6])
661 {
662  for (int isou = 0; isou < 6; isou++)
663  pf[isou] = p[isou];
664 }
665 
666 /*----------------------------------------------------------------------------*/
675 /*----------------------------------------------------------------------------*/
676 
677 inline static void
678 cs_centered_f_val(const double pnd,
679  const cs_real_t pip,
680  const cs_real_t pjp,
681  cs_real_t *pf)
682 {
683  *pf = pnd*pip + (1.-pnd)*pjp;
684 }
685 
686 /*----------------------------------------------------------------------------*/
695 /*----------------------------------------------------------------------------*/
696 
697 inline static void
698 cs_centered_f_val_vector(const double pnd,
699  const cs_real_3_t pip,
700  const cs_real_3_t pjp,
701  cs_real_t pf[3])
702 {
703  for (int isou = 0; isou < 3; isou++)
704  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
705 }
706 
707 /*----------------------------------------------------------------------------*/
716 /*----------------------------------------------------------------------------*/
717 
718 inline static void
719 cs_centered_f_val_tensor(const double pnd,
720  const cs_real_6_t pip,
721  const cs_real_6_t pjp,
722  cs_real_t pf[6])
723 {
724  for (int isou = 0; isou < 6; isou++)
725  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
726 }
727 
728 /*----------------------------------------------------------------------------*/
738 /*----------------------------------------------------------------------------*/
739 
740 inline static void
741 cs_solu_f_val(const cs_real_3_t cell_cen,
742  const cs_real_3_t i_face_cog,
743  const cs_real_3_t grad,
744  const cs_real_t p,
745  cs_real_t *pf)
746 {
747  cs_real_3_t df;
748 
749  df[0] = i_face_cog[0] - cell_cen[0];
750  df[1] = i_face_cog[1] - cell_cen[1];
751  df[2] = i_face_cog[2] - cell_cen[2];
752 
753  *pf = p + cs_math_3_dot_product(df, grad);
754 }
755 
756 /*----------------------------------------------------------------------------*/
766 /*----------------------------------------------------------------------------*/
767 
768 inline static void
770  const cs_real_3_t i_face_cog,
771  const cs_real_33_t grad,
772  const cs_real_3_t p,
773  cs_real_t pf[3])
774 {
775  cs_real_3_t df;
776 
777  for (int jsou = 0; jsou < 3; jsou++)
778  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
779 
780  for (int isou = 0; isou < 3; isou++) {
781  pf[isou] = p[isou] + df[0]*grad[isou][0]
782  + df[1]*grad[isou][1]
783  + df[2]*grad[isou][2];
784 
785  }
786 }
787 
788 /*----------------------------------------------------------------------------*/
798 /*----------------------------------------------------------------------------*/
799 
800 inline static void
802  const cs_real_3_t i_face_cog,
803  const cs_real_63_t grad,
804  const cs_real_6_t p,
805  cs_real_t pf[6])
806 {
807  cs_real_3_t df;
808 
809  for (int jsou = 0; jsou < 3; jsou++)
810  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
811 
812  for (int isou = 0; isou < 6; isou++) {
813  pf[isou] = p[isou] + df[0]*grad[isou][0]
814  + df[1]*grad[isou][1]
815  + df[2]*grad[isou][2];
816  }
817 }
818 
819 /*----------------------------------------------------------------------------*/
829 /*----------------------------------------------------------------------------*/
830 
831 inline static void
832 cs_blend_f_val(const double blencp,
833  const cs_real_t p,
834  cs_real_t *pf)
835 {
836  *pf = blencp * (*pf) + (1. - blencp) * p;
837 }
838 
839 /*----------------------------------------------------------------------------*/
849 /*----------------------------------------------------------------------------*/
850 
851 inline static void
852 cs_blend_f_val_vector(const double blencp,
853  const cs_real_3_t p,
854  cs_real_t pf[3])
855 {
856  for (int isou = 0; isou < 3; isou++)
857  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
858 }
859 
860 /*----------------------------------------------------------------------------*/
870 /*----------------------------------------------------------------------------*/
871 
872 inline static void
873 cs_blend_f_val_tensor(const double blencp,
874  const cs_real_6_t p,
875  cs_real_t pf[6])
876 {
877  for (int isou = 0; isou < 6; isou++)
878  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
879 }
880 
881 /*----------------------------------------------------------------------------*/
902 /*----------------------------------------------------------------------------*/
903 
904 inline static void
905 cs_i_conv_flux(const int iconvp,
906  const cs_real_t thetap,
907  const int imasac,
908  const cs_real_t pi,
909  const cs_real_t pj,
910  const cs_real_t pifri,
911  const cs_real_t pifrj,
912  const cs_real_t pjfri,
913  const cs_real_t pjfrj,
914  const cs_real_t i_massflux,
915  const cs_real_t xcppi,
916  const cs_real_t xcppj,
917  cs_real_2_t fluxij)
918 {
919  cs_real_t flui, fluj;
920 
921  flui = 0.5*(i_massflux + fabs(i_massflux));
922  fluj = 0.5*(i_massflux - fabs(i_massflux));
923 
924  fluxij[0] += iconvp*xcppi*(thetap*(flui*pifri + fluj*pjfri) - imasac*i_massflux*pi);
925  fluxij[1] += iconvp*xcppj*(thetap*(flui*pifrj + fluj*pjfrj) - imasac*i_massflux*pj);
926 }
927 
928 /*----------------------------------------------------------------------------*/
946 /*----------------------------------------------------------------------------*/
947 
948 inline static void
949 cs_i_conv_flux_vector(const int iconvp,
950  const cs_real_t thetap,
951  const int imasac,
952  const cs_real_3_t pi,
953  const cs_real_3_t pj,
954  const cs_real_3_t pifri,
955  const cs_real_3_t pifrj,
956  const cs_real_3_t pjfri,
957  const cs_real_3_t pjfrj,
958  const cs_real_t i_massflux,
959  cs_real_t fluxi[3],
960  cs_real_t fluxj[3])
961 {
962  cs_real_t flui, fluj;
963 
964  flui = 0.5*(i_massflux + fabs(i_massflux));
965  fluj = 0.5*(i_massflux - fabs(i_massflux));
966 
967  for (int isou = 0; isou < 3; isou++) {
968 
969  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
970  - imasac*i_massflux*pi[isou]);
971  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
972  - imasac*i_massflux*pj[isou]);
973  }
974 }
975 
976 /*----------------------------------------------------------------------------*/
994 /*----------------------------------------------------------------------------*/
995 
996 inline static void
997 cs_i_conv_flux_tensor(const int iconvp,
998  const cs_real_t thetap,
999  const int imasac,
1000  const cs_real_6_t pi,
1001  const cs_real_6_t pj,
1002  const cs_real_6_t pifri,
1003  const cs_real_6_t pifrj,
1004  const cs_real_6_t pjfri,
1005  const cs_real_6_t pjfrj,
1006  const cs_real_t i_massflux,
1007  cs_real_t fluxi[6],
1008  cs_real_t fluxj[6])
1009 {
1010  cs_real_t flui, fluj;
1011 
1012  flui = 0.5*(i_massflux + fabs(i_massflux));
1013  fluj = 0.5*(i_massflux - fabs(i_massflux));
1014 
1015  for (int isou = 0; isou < 6; isou++) {
1016  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1017  - imasac*i_massflux*pi[isou]);
1018  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1019  - imasac*i_massflux*pj[isou]);
1020  }
1021 }
1022 
1023 /*----------------------------------------------------------------------------*/
1036 /*----------------------------------------------------------------------------*/
1037 
1038 inline static void
1039 cs_i_diff_flux(const int idiffp,
1040  const cs_real_t thetap,
1041  const cs_real_t pip,
1042  const cs_real_t pjp,
1043  const cs_real_t pipr,
1044  const cs_real_t pjpr,
1045  const cs_real_t i_visc,
1046  cs_real_2_t fluxij)
1047 {
1048  fluxij[0] += idiffp*thetap*i_visc*(pipr -pjp);
1049  fluxij[1] += idiffp*thetap*i_visc*(pip -pjpr);
1050 }
1051 
1052 /*----------------------------------------------------------------------------*/
1066 /*----------------------------------------------------------------------------*/
1067 
1068 inline static void
1069 cs_i_diff_flux_vector(const int idiffp,
1070  const cs_real_t thetap,
1071  const cs_real_3_t pip,
1072  const cs_real_3_t pjp,
1073  const cs_real_3_t pipr,
1074  const cs_real_3_t pjpr,
1075  const cs_real_t i_visc,
1076  cs_real_t fluxi[3],
1077  cs_real_t fluxj[3])
1078 {
1079  for (int isou = 0; isou < 3; isou++) {
1080  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1081  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1082  }
1083 }
1084 
1085 /*----------------------------------------------------------------------------*/
1099 /*----------------------------------------------------------------------------*/
1100 
1101 inline static void
1102 cs_i_diff_flux_tensor(const int idiffp,
1103  const cs_real_t thetap,
1104  const cs_real_6_t pip,
1105  const cs_real_6_t pjp,
1106  const cs_real_6_t pipr,
1107  const cs_real_6_t pjpr,
1108  const cs_real_t i_visc,
1109  cs_real_t fluxi[6],
1110  cs_real_t fluxj[6])
1111 {
1112  for (int isou = 0; isou < 6; isou++) {
1113  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1114  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1115  }
1116 }
1117 
1118 /*----------------------------------------------------------------------------*/
1145 /*----------------------------------------------------------------------------*/
1146 
1147 inline static void
1148 cs_i_cd_steady_upwind(const int ircflp,
1149  const cs_real_t relaxp,
1150  const cs_real_t weight,
1151  const cs_real_3_t cell_ceni,
1152  const cs_real_3_t cell_cenj,
1153  const cs_real_3_t i_face_cog,
1154  const cs_real_3_t dijpf,
1155  const cs_real_3_t gradi,
1156  const cs_real_3_t gradj,
1157  const cs_real_t pi,
1158  const cs_real_t pj,
1159  const cs_real_t pia,
1160  const cs_real_t pja,
1161  cs_real_t *pifri,
1162  cs_real_t *pifrj,
1163  cs_real_t *pjfri,
1164  cs_real_t *pjfrj,
1165  cs_real_t *pip,
1166  cs_real_t *pjp,
1167  cs_real_t *pipr,
1168  cs_real_t *pjpr)
1169 {
1170  cs_real_t pir, pjr;
1171  cs_real_t recoi, recoj;
1172 
1173  cs_i_compute_quantities(ircflp,
1174  weight,
1175  cell_ceni,
1176  cell_cenj,
1177  i_face_cog,
1178  dijpf,
1179  gradi,
1180  gradj,
1181  pi,
1182  pj,
1183  &recoi,
1184  &recoj,
1185  pip,
1186  pjp);
1187 
1188  cs_i_relax_c_val(relaxp,
1189  pia,
1190  pja,
1191  recoi,
1192  recoj,
1193  pi,
1194  pj,
1195  &pir,
1196  &pjr,
1197  pipr,
1198  pjpr);
1199 
1200  cs_upwind_f_val(pi,
1201  pifrj);
1202  cs_upwind_f_val(pir,
1203  pifri);
1204  cs_upwind_f_val(pj,
1205  pjfri);
1206  cs_upwind_f_val(pjr,
1207  pjfrj);
1208 }
1209 
1210 /*----------------------------------------------------------------------------*/
1237 /*----------------------------------------------------------------------------*/
1238 
1239 inline static void
1241  const cs_real_t relaxp,
1242  const cs_real_t weight,
1243  const cs_real_3_t cell_ceni,
1244  const cs_real_3_t cell_cenj,
1245  const cs_real_3_t i_face_cog,
1246  const cs_real_3_t dijpf,
1247  const cs_real_33_t gradi,
1248  const cs_real_33_t gradj,
1249  const cs_real_3_t pi,
1250  const cs_real_3_t pj,
1251  const cs_real_3_t pia,
1252  const cs_real_3_t pja,
1253  cs_real_t pifri[3],
1254  cs_real_t pifrj[3],
1255  cs_real_t pjfri[3],
1256  cs_real_t pjfrj[3],
1257  cs_real_t pip[3],
1258  cs_real_t pjp[3],
1259  cs_real_t pipr[3],
1260  cs_real_t pjpr[3])
1261 {
1262  cs_real_3_t pir, pjr;
1263  cs_real_3_t recoi, recoj;
1264 
1266  weight,
1267  cell_ceni,
1268  cell_cenj,
1269  i_face_cog,
1270  dijpf,
1271  gradi,
1272  gradj,
1273  pi,
1274  pj,
1275  recoi,
1276  recoj,
1277  pip,
1278  pjp);
1279 
1280  cs_i_relax_c_val_vector(relaxp,
1281  pia,
1282  pja,
1283  recoi,
1284  recoj,
1285  pi,
1286  pj,
1287  pir,
1288  pjr,
1289  pipr,
1290  pjpr);
1291 
1293  pifrj);
1295  pifri);
1297  pjfri);
1299  pjfrj);
1300 
1301 }
1302 
1303 /*----------------------------------------------------------------------------*/
1330 /*----------------------------------------------------------------------------*/
1331 
1332 inline static void
1334  const cs_real_t relaxp,
1335  const cs_real_t weight,
1336  const cs_real_3_t cell_ceni,
1337  const cs_real_3_t cell_cenj,
1338  const cs_real_3_t i_face_cog,
1339  const cs_real_3_t dijpf,
1340  const cs_real_63_t gradi,
1341  const cs_real_63_t gradj,
1342  const cs_real_6_t pi,
1343  const cs_real_6_t pj,
1344  const cs_real_6_t pia,
1345  const cs_real_6_t pja,
1346  cs_real_t pifri[6],
1347  cs_real_t pifrj[6],
1348  cs_real_t pjfri[6],
1349  cs_real_t pjfrj[6],
1350  cs_real_t pip[6],
1351  cs_real_t pjp[6],
1352  cs_real_t pipr[6],
1353  cs_real_t pjpr[6])
1354 {
1355  cs_real_6_t pir, pjr;
1356  cs_real_6_t recoi, recoj;
1357 
1359  weight,
1360  cell_ceni,
1361  cell_cenj,
1362  i_face_cog,
1363  dijpf,
1364  gradi,
1365  gradj,
1366  pi,
1367  pj,
1368  recoi,
1369  recoj,
1370  pip,
1371  pjp);
1372 
1373  cs_i_relax_c_val_tensor(relaxp,
1374  pia,
1375  pja,
1376  recoi,
1377  recoj,
1378  pi,
1379  pj,
1380  pir,
1381  pjr,
1382  pipr,
1383  pjpr);
1384 
1386  pifrj);
1388  pifri);
1390  pjfri);
1392  pjfrj);
1393 }
1394 
1395 /*----------------------------------------------------------------------------*/
1415 /*----------------------------------------------------------------------------*/
1416 
1417 inline static void
1418 cs_i_cd_unsteady_upwind(const int ircflp,
1419  const cs_real_t weight,
1420  const cs_real_3_t cell_ceni,
1421  const cs_real_3_t cell_cenj,
1422  const cs_real_3_t i_face_cog,
1423  const cs_real_3_t dijpf,
1424  const cs_real_3_t gradi,
1425  const cs_real_3_t gradj,
1426  const cs_real_t pi,
1427  const cs_real_t pj,
1428  cs_real_t *pif,
1429  cs_real_t *pjf,
1430  cs_real_t *pip,
1431  cs_real_t *pjp)
1432 {
1433  cs_real_t recoi, recoj;
1434 
1435  cs_i_compute_quantities(ircflp,
1436  weight,
1437  cell_ceni,
1438  cell_cenj,
1439  i_face_cog,
1440  dijpf,
1441  gradi,
1442  gradj,
1443  pi,
1444  pj,
1445  &recoi,
1446  &recoj,
1447  pip,
1448  pjp);
1449 
1450  cs_upwind_f_val(pi, pif);
1451  cs_upwind_f_val(pj, pjf);
1452 }
1453 
1454 /*----------------------------------------------------------------------------*/
1474 /*----------------------------------------------------------------------------*/
1475 
1476 inline static void
1478  const cs_real_t weight,
1479  const cs_real_3_t cell_ceni,
1480  const cs_real_3_t cell_cenj,
1481  const cs_real_3_t i_face_cog,
1482  const cs_real_3_t dijpf,
1483  const cs_real_33_t gradi,
1484  const cs_real_33_t gradj,
1485  const cs_real_3_t pi,
1486  const cs_real_3_t pj,
1487  cs_real_t pif[3],
1488  cs_real_t pjf[3],
1489  cs_real_t pip[3],
1490  cs_real_t pjp[3])
1491 {
1492  cs_real_3_t recoi, recoj;
1493 
1495  weight,
1496  cell_ceni,
1497  cell_cenj,
1498  i_face_cog,
1499  dijpf,
1500  gradi,
1501  gradj,
1502  pi,
1503  pj,
1504  recoi,
1505  recoj,
1506  pip,
1507  pjp);
1508 
1509  cs_upwind_f_val_vector(pi, pif);
1510  cs_upwind_f_val_vector(pj, pjf);
1511 
1512 }
1513 
1514 /*----------------------------------------------------------------------------*/
1534 /*----------------------------------------------------------------------------*/
1535 
1536 inline static void
1538  const cs_real_t weight,
1539  const cs_real_3_t cell_ceni,
1540  const cs_real_3_t cell_cenj,
1541  const cs_real_3_t i_face_cog,
1542  const cs_real_3_t dijpf,
1543  const cs_real_63_t gradi,
1544  const cs_real_63_t gradj,
1545  const cs_real_6_t pi,
1546  const cs_real_6_t pj,
1547  cs_real_t pif[6],
1548  cs_real_t pjf[6],
1549  cs_real_t pip[6],
1550  cs_real_t pjp[6])
1551 {
1552  cs_real_6_t recoi, recoj;
1553 
1555  weight,
1556  cell_ceni,
1557  cell_cenj,
1558  i_face_cog,
1559  dijpf,
1560  gradi,
1561  gradj,
1562  pi,
1563  pj,
1564  recoi,
1565  recoj,
1566  pip,
1567  pjp);
1568 
1569  cs_upwind_f_val_tensor(pi, pif);
1570  cs_upwind_f_val_tensor(pj, pjf);
1571 
1572 }
1573 
1574 /*----------------------------------------------------------------------------*/
1606 /*----------------------------------------------------------------------------*/
1607 
1608 inline static void
1609 cs_i_cd_steady(const int ircflp,
1610  const int ischcp,
1611  const double relaxp,
1612  const double blencp,
1613  const cs_real_t weight,
1614  const cs_real_3_t cell_ceni,
1615  const cs_real_3_t cell_cenj,
1616  const cs_real_3_t i_face_cog,
1617  const cs_real_3_t dijpf,
1618  const cs_real_3_t gradi,
1619  const cs_real_3_t gradj,
1620  const cs_real_3_t gradupi,
1621  const cs_real_3_t gradupj,
1622  const cs_real_t pi,
1623  const cs_real_t pj,
1624  const cs_real_t pia,
1625  const cs_real_t pja,
1626  cs_real_t *pifri,
1627  cs_real_t *pifrj,
1628  cs_real_t *pjfri,
1629  cs_real_t *pjfrj,
1630  cs_real_t *pip,
1631  cs_real_t *pjp,
1632  cs_real_t *pipr,
1633  cs_real_t *pjpr)
1634 {
1635  cs_real_t pir, pjr;
1636  cs_real_t recoi, recoj;
1637 
1638  cs_i_compute_quantities(ircflp,
1639  weight,
1640  cell_ceni,
1641  cell_cenj,
1642  i_face_cog,
1643  dijpf,
1644  gradi,
1645  gradj,
1646  pi,
1647  pj,
1648  &recoi,
1649  &recoj,
1650  pip,
1651  pjp);
1652 
1653  cs_i_relax_c_val(relaxp,
1654  pia,
1655  pja,
1656  recoi,
1657  recoj,
1658  pi,
1659  pj,
1660  &pir,
1661  &pjr,
1662  pipr,
1663  pjpr);
1664 
1665  if (ischcp == 1) {
1666 
1667  /* Centered
1668  --------*/
1669 
1670  cs_centered_f_val(weight,
1671  *pip,
1672  *pjpr,
1673  pifrj);
1674  cs_centered_f_val(weight,
1675  *pipr,
1676  *pjp,
1677  pifri);
1678  cs_centered_f_val(weight,
1679  *pipr,
1680  *pjp,
1681  pjfri);
1682  cs_centered_f_val(weight,
1683  *pip,
1684  *pjpr,
1685  pjfrj);
1686 
1687  } else if (ischcp == 0) {
1688 
1689  /* Original SOLU
1690  --------------*/
1691 
1692  cs_solu_f_val(cell_ceni,
1693  i_face_cog,
1694  gradi,
1695  pi,
1696  pifrj);
1697  cs_solu_f_val(cell_ceni,
1698  i_face_cog,
1699  gradi,
1700  pir,
1701  pifri);
1702  cs_solu_f_val(cell_cenj,
1703  i_face_cog,
1704  gradj,
1705  pj,
1706  pjfri);
1707  cs_solu_f_val(cell_cenj,
1708  i_face_cog,
1709  gradj,
1710  pjr,
1711  pjfrj);
1712 
1713  } else {
1714 
1715  /* SOLU
1716  ----*/
1717 
1718  cs_solu_f_val(cell_ceni,
1719  i_face_cog,
1720  gradupi,
1721  pi,
1722  pifrj);
1723  cs_solu_f_val(cell_ceni,
1724  i_face_cog,
1725  gradupi,
1726  pir,
1727  pifri);
1728  cs_solu_f_val(cell_cenj,
1729  i_face_cog,
1730  gradupj,
1731  pj,
1732  pjfri);
1733  cs_solu_f_val(cell_cenj,
1734  i_face_cog,
1735  gradupj,
1736  pjr,
1737  pjfrj);
1738 
1739  }
1740 
1741  /* Blending
1742  --------*/
1743 
1744  cs_blend_f_val(blencp,
1745  pi,
1746  pifrj);
1747  cs_blend_f_val(blencp,
1748  pir,
1749  pifri);
1750  cs_blend_f_val(blencp,
1751  pj,
1752  pjfri);
1753  cs_blend_f_val(blencp,
1754  pjr,
1755  pjfrj);
1756 }
1757 
1758 /*----------------------------------------------------------------------------*/
1788 /*----------------------------------------------------------------------------*/
1789 
1790 inline static void
1791 cs_i_cd_steady_vector(const int ircflp,
1792  const int ischcp,
1793  const double relaxp,
1794  const double blencp,
1795  const cs_real_t weight,
1796  const cs_real_3_t cell_ceni,
1797  const cs_real_3_t cell_cenj,
1798  const cs_real_3_t i_face_cog,
1799  const cs_real_3_t dijpf,
1800  const cs_real_33_t gradi,
1801  const cs_real_33_t gradj,
1802  const cs_real_3_t pi,
1803  const cs_real_3_t pj,
1804  const cs_real_3_t pia,
1805  const cs_real_3_t pja,
1806  cs_real_t pifri[3],
1807  cs_real_t pifrj[3],
1808  cs_real_t pjfri[3],
1809  cs_real_t pjfrj[3],
1810  cs_real_t pip[3],
1811  cs_real_t pjp[3],
1812  cs_real_t pipr[3],
1813  cs_real_t pjpr[3])
1814 {
1815  cs_real_3_t pir, pjr;
1816  cs_real_3_t recoi, recoj;
1817 
1819  weight,
1820  cell_ceni,
1821  cell_cenj,
1822  i_face_cog,
1823  dijpf,
1824  gradi,
1825  gradj,
1826  pi,
1827  pj,
1828  recoi,
1829  recoj,
1830  pip,
1831  pjp);
1832 
1833  cs_i_relax_c_val_vector(relaxp,
1834  pia,
1835  pja,
1836  recoi,
1837  recoj,
1838  pi,
1839  pj,
1840  pir,
1841  pjr,
1842  pipr,
1843  pjpr);
1844 
1845  if (ischcp == 1) {
1846 
1847  /* Centered
1848  --------*/
1849 
1850  cs_centered_f_val_vector(weight,
1851  pip,
1852  pjpr,
1853  pifrj);
1854  cs_centered_f_val_vector(weight,
1855  pipr,
1856  pjp,
1857  pifri);
1858  cs_centered_f_val_vector(weight,
1859  pipr,
1860  pjp,
1861  pjfri);
1862  cs_centered_f_val_vector(weight,
1863  pip,
1864  pjpr,
1865  pjfrj);
1866 
1867  } else {
1868 
1869  /* Second order
1870  ------------*/
1871 
1872  cs_solu_f_val_vector(cell_ceni,
1873  i_face_cog,
1874  gradi,
1875  pi,
1876  pifrj);
1877  cs_solu_f_val_vector(cell_ceni,
1878  i_face_cog,
1879  gradi,
1880  pir,
1881  pifri);
1882  cs_solu_f_val_vector(cell_cenj,
1883  i_face_cog,
1884  gradj,
1885  pj,
1886  pjfri);
1887  cs_solu_f_val_vector(cell_cenj,
1888  i_face_cog,
1889  gradj,
1890  pjr,
1891  pjfrj);
1892 
1893  }
1894 
1895  /* Blending
1896  --------*/
1897  cs_blend_f_val_vector(blencp,
1898  pi,
1899  pifrj);
1900  cs_blend_f_val_vector(blencp,
1901  pir,
1902  pifri);
1903  cs_blend_f_val_vector(blencp,
1904  pj,
1905  pjfri);
1906  cs_blend_f_val_vector(blencp,
1907  pjr,
1908  pjfrj);
1909 
1910 }
1911 
1912 /*----------------------------------------------------------------------------*/
1942 /*----------------------------------------------------------------------------*/
1943 
1944 inline static void
1945 cs_i_cd_steady_tensor(const int ircflp,
1946  const int ischcp,
1947  const double relaxp,
1948  const double blencp,
1949  const cs_real_t weight,
1950  const cs_real_3_t cell_ceni,
1951  const cs_real_3_t cell_cenj,
1952  const cs_real_3_t i_face_cog,
1953  const cs_real_3_t dijpf,
1954  const cs_real_63_t gradi,
1955  const cs_real_63_t gradj,
1956  const cs_real_6_t pi,
1957  const cs_real_6_t pj,
1958  const cs_real_6_t pia,
1959  const cs_real_6_t pja,
1960  cs_real_t pifri[6],
1961  cs_real_t pifrj[6],
1962  cs_real_t pjfri[6],
1963  cs_real_t pjfrj[6],
1964  cs_real_t pip[6],
1965  cs_real_t pjp[6],
1966  cs_real_t pipr[6],
1967  cs_real_t pjpr[6])
1968 
1969 {
1970  cs_real_6_t pir, pjr;
1971  cs_real_6_t recoi, recoj;
1972 
1974  weight,
1975  cell_ceni,
1976  cell_cenj,
1977  i_face_cog,
1978  dijpf,
1979  gradi,
1980  gradj,
1981  pi,
1982  pj,
1983  recoi,
1984  recoj,
1985  pip,
1986  pjp);
1987 
1988  cs_i_relax_c_val_tensor(relaxp,
1989  pia,
1990  pja,
1991  recoi,
1992  recoj,
1993  pi,
1994  pj,
1995  pir,
1996  pjr,
1997  pipr,
1998  pjpr);
1999 
2000  if (ischcp == 1) {
2001 
2002  /* Centered
2003  --------*/
2004 
2005  cs_centered_f_val_tensor(weight,
2006  pip,
2007  pjpr,
2008  pifrj);
2009  cs_centered_f_val_tensor(weight,
2010  pipr,
2011  pjp,
2012  pifri);
2013  cs_centered_f_val_tensor(weight,
2014  pipr,
2015  pjp,
2016  pjfri);
2017  cs_centered_f_val_tensor(weight,
2018  pip,
2019  pjpr,
2020  pjfrj);
2021 
2022  } else {
2023 
2024  /* Second order
2025  ------------*/
2026 
2027  cs_solu_f_val_tensor(cell_ceni,
2028  i_face_cog,
2029  gradi,
2030  pi,
2031  pifrj);
2032  cs_solu_f_val_tensor(cell_ceni,
2033  i_face_cog,
2034  gradi,
2035  pir,
2036  pifri);
2037  cs_solu_f_val_tensor(cell_cenj,
2038  i_face_cog,
2039  gradj,
2040  pj,
2041  pjfri);
2042  cs_solu_f_val_tensor(cell_cenj,
2043  i_face_cog,
2044  gradj,
2045  pjr,
2046  pjfrj);
2047 
2048  }
2049 
2050  /* Blending
2051  --------*/
2052 
2053  cs_blend_f_val_tensor(blencp,
2054  pi,
2055  pifrj);
2056  cs_blend_f_val_tensor(blencp,
2057  pir,
2058  pifri);
2059  cs_blend_f_val_tensor(blencp,
2060  pj,
2061  pjfri);
2062  cs_blend_f_val_tensor(blencp,
2063  pjr,
2064  pjfrj);
2065 
2066 }
2067 
2068 /*----------------------------------------------------------------------------*/
2095 /*----------------------------------------------------------------------------*/
2096 
2097 inline static void
2098 cs_i_cd_unsteady(const int ircflp,
2099  const int ischcp,
2100  const double blencp,
2101  const cs_real_t weight,
2102  const cs_real_3_t cell_ceni,
2103  const cs_real_3_t cell_cenj,
2104  const cs_real_3_t i_face_cog,
2105  const cs_real_3_t dijpf,
2106  const cs_real_3_t gradi,
2107  const cs_real_3_t gradj,
2108  const cs_real_3_t gradupi,
2109  const cs_real_3_t gradupj,
2110  const cs_real_t pi,
2111  const cs_real_t pj,
2112  cs_real_t *pif,
2113  cs_real_t *pjf,
2114  cs_real_t *pip,
2115  cs_real_t *pjp)
2116 {
2117  cs_real_t recoi, recoj;
2118 
2119  cs_i_compute_quantities(ircflp,
2120  weight,
2121  cell_ceni,
2122  cell_cenj,
2123  i_face_cog,
2124  dijpf,
2125  gradi,
2126  gradj,
2127  pi,
2128  pj,
2129  &recoi,
2130  &recoj,
2131  pip,
2132  pjp);
2133 
2134 
2135  if (ischcp == 1) {
2136 
2137  /* Centered
2138  --------*/
2139 
2140  cs_centered_f_val(weight,
2141  *pip,
2142  *pjp,
2143  pif);
2144  cs_centered_f_val(weight,
2145  *pip,
2146  *pjp,
2147  pjf);
2148 
2149  } else if (ischcp == 0) {
2150 
2151  /* Original SOLU
2152  ------------*/
2153 
2154  cs_solu_f_val(cell_ceni,
2155  i_face_cog,
2156  gradi,
2157  pi,
2158  pif);
2159  cs_solu_f_val(cell_cenj,
2160  i_face_cog,
2161  gradj,
2162  pj,
2163  pjf);
2164 
2165  } else {
2166 
2167  /* SOLU
2168  ----*/
2169 
2170  cs_solu_f_val(cell_ceni,
2171  i_face_cog,
2172  gradupi,
2173  pi,
2174  pif);
2175  cs_solu_f_val(cell_cenj,
2176  i_face_cog,
2177  gradupj,
2178  pj,
2179  pjf);
2180 
2181  }
2182 
2183 
2184  /* Blending
2185  --------*/
2186 
2187  cs_blend_f_val(blencp,
2188  pi,
2189  pif);
2190  cs_blend_f_val(blencp,
2191  pj,
2192  pjf);
2193 }
2194 
2195 /*----------------------------------------------------------------------------*/
2218 /*----------------------------------------------------------------------------*/
2219 
2220 inline static void
2221 cs_i_cd_unsteady_vector(const int ircflp,
2222  const int ischcp,
2223  const double blencp,
2224  const cs_real_t weight,
2225  const cs_real_3_t cell_ceni,
2226  const cs_real_3_t cell_cenj,
2227  const cs_real_3_t i_face_cog,
2228  const cs_real_3_t dijpf,
2229  const cs_real_33_t gradi,
2230  const cs_real_33_t gradj,
2231  const cs_real_3_t pi,
2232  const cs_real_3_t pj,
2233  cs_real_t pif[3],
2234  cs_real_t pjf[3],
2235  cs_real_t pip[3],
2236  cs_real_t pjp[3])
2237 
2238 {
2239  cs_real_3_t recoi, recoj;
2240 
2242  weight,
2243  cell_ceni,
2244  cell_cenj,
2245  i_face_cog,
2246  dijpf,
2247  gradi,
2248  gradj,
2249  pi,
2250  pj,
2251  recoi,
2252  recoj,
2253  pip,
2254  pjp);
2255 
2256  if (ischcp == 1) {
2257 
2258  /* Centered
2259  --------*/
2260 
2261  cs_centered_f_val_vector(weight,
2262  pip,
2263  pjp,
2264  pif);
2265  cs_centered_f_val_vector(weight,
2266  pip,
2267  pjp,
2268  pjf);
2269 
2270  } else {
2271 
2272  /* Second order
2273  ------------*/
2274 
2275  cs_solu_f_val_vector(cell_ceni,
2276  i_face_cog,
2277  gradi,
2278  pi,
2279  pif);
2280  cs_solu_f_val_vector(cell_cenj,
2281  i_face_cog,
2282  gradj,
2283  pj,
2284  pjf);
2285 
2286  }
2287 
2288  /* Blending
2289  --------*/
2290 
2291  cs_blend_f_val_vector(blencp,
2292  pi,
2293  pif);
2294  cs_blend_f_val_vector(blencp,
2295  pj,
2296  pjf);
2297 }
2298 
2299 /*----------------------------------------------------------------------------*/
2322 /*----------------------------------------------------------------------------*/
2323 
2324 inline static void
2325 cs_i_cd_unsteady_tensor(const int ircflp,
2326  const int ischcp,
2327  const double blencp,
2328  const cs_real_t weight,
2329  const cs_real_3_t cell_ceni,
2330  const cs_real_3_t cell_cenj,
2331  const cs_real_3_t i_face_cog,
2332  const cs_real_3_t dijpf,
2333  const cs_real_63_t gradi,
2334  const cs_real_63_t gradj,
2335  const cs_real_6_t pi,
2336  const cs_real_6_t pj,
2337  cs_real_t pif[6],
2338  cs_real_t pjf[6],
2339  cs_real_t pip[6],
2340  cs_real_t pjp[6])
2341 
2342 {
2343  cs_real_6_t recoi, recoj;
2344 
2346  weight,
2347  cell_ceni,
2348  cell_cenj,
2349  i_face_cog,
2350  dijpf,
2351  gradi,
2352  gradj,
2353  pi,
2354  pj,
2355  recoi,
2356  recoj,
2357  pip,
2358  pjp);
2359 
2360  if (ischcp == 1) {
2361 
2362  /* Centered
2363  --------*/
2364 
2365  cs_centered_f_val_tensor(weight,
2366  pip,
2367  pjp,
2368  pif);
2369  cs_centered_f_val_tensor(weight,
2370  pip,
2371  pjp,
2372  pjf);
2373 
2374  } else {
2375 
2376  /* Second order
2377  ------------*/
2378 
2379  cs_solu_f_val_tensor(cell_ceni,
2380  i_face_cog,
2381  gradi,
2382  pi,
2383  pif);
2384  cs_solu_f_val_tensor(cell_cenj,
2385  i_face_cog,
2386  gradj,
2387  pj,
2388  pjf);
2389 
2390  }
2391 
2392  /* Blending
2393  --------*/
2394 
2395  cs_blend_f_val_tensor(blencp,
2396  pi,
2397  pif);
2398  cs_blend_f_val_tensor(blencp,
2399  pj,
2400  pjf);
2401 
2402 }
2403 
2404 /*----------------------------------------------------------------------------*/
2444 /*----------------------------------------------------------------------------*/
2445 
2446 inline static void
2447 cs_i_cd_steady_slope_test(bool *upwind_switch,
2448  const int iconvp,
2449  const int ircflp,
2450  const int ischcp,
2451  const double relaxp,
2452  const double blencp,
2453  const cs_real_t weight,
2454  const cs_real_t i_dist,
2455  const cs_real_t i_face_surf,
2456  const cs_real_3_t cell_ceni,
2457  const cs_real_3_t cell_cenj,
2458  const cs_real_3_t i_face_normal,
2459  const cs_real_3_t i_face_cog,
2460  const cs_real_3_t dijpf,
2461  const cs_real_t i_massflux,
2462  const cs_real_3_t gradi,
2463  const cs_real_3_t gradj,
2464  const cs_real_3_t gradupi,
2465  const cs_real_3_t gradupj,
2466  const cs_real_3_t gradsti,
2467  const cs_real_3_t gradstj,
2468  const cs_real_t pi,
2469  const cs_real_t pj,
2470  const cs_real_t pia,
2471  const cs_real_t pja,
2472  cs_real_t *pifri,
2473  cs_real_t *pifrj,
2474  cs_real_t *pjfri,
2475  cs_real_t *pjfrj,
2476  cs_real_t *pip,
2477  cs_real_t *pjp,
2478  cs_real_t *pipr,
2479  cs_real_t *pjpr)
2480 {
2481  cs_real_t pir, pjr;
2482  cs_real_t recoi, recoj;
2483  cs_real_t distf, srfan, testij, tesqck;
2484 
2485  distf = i_dist;
2486  srfan = i_face_surf;
2487 
2488  *upwind_switch = false;
2489 
2490  cs_i_compute_quantities(ircflp,
2491  weight,
2492  cell_ceni,
2493  cell_cenj,
2494  i_face_cog,
2495  dijpf,
2496  gradi,
2497  gradj,
2498  pi,
2499  pj,
2500  &recoi,
2501  &recoj,
2502  pip,
2503  pjp);
2504 
2505  cs_i_relax_c_val(relaxp,
2506  pia,
2507  pja,
2508  recoi,
2509  recoj,
2510  pi,
2511  pj,
2512  &pir,
2513  &pjr,
2514  pipr,
2515  pjpr);
2516 
2517  /* Convection slope test is needed only when iconv >0 */
2518  if (iconvp > 0) {
2519  cs_slope_test(pi,
2520  pj,
2521  distf,
2522  srfan,
2523  i_face_normal,
2524  gradi,
2525  gradj,
2526  gradsti,
2527  gradstj,
2528  i_massflux,
2529  &testij,
2530  &tesqck);
2531 
2532  if (tesqck<=0. || testij<=0.) {
2533 
2534  /* Upwind
2535  --------*/
2536 
2537  cs_upwind_f_val(pi,
2538  pifrj);
2539  cs_upwind_f_val(pir,
2540  pifri);
2541  cs_upwind_f_val(pj,
2542  pjfri);
2543  cs_upwind_f_val(pjr,
2544  pjfrj);
2545 
2546  *upwind_switch = true;
2547 
2548  } else {
2549 
2550  if (ischcp==1) {
2551 
2552  /* Centered
2553  --------*/
2554 
2555  cs_centered_f_val(weight,
2556  *pip,
2557  *pjpr,
2558  pifrj);
2559  cs_centered_f_val(weight,
2560  *pipr,
2561  *pjp,
2562  pifri);
2563  cs_centered_f_val(weight,
2564  *pipr,
2565  *pjp,
2566  pjfri);
2567  cs_centered_f_val(weight,
2568  *pip,
2569  *pjpr,
2570  pjfrj);
2571 
2572  } else if (ischcp == 0) {
2573 
2574  /* Second order
2575  ------------*/
2576 
2577  cs_solu_f_val(cell_ceni,
2578  i_face_cog,
2579  gradi,
2580  pi,
2581  pifrj);
2582  cs_solu_f_val(cell_ceni,
2583  i_face_cog,
2584  gradi,
2585  pir,
2586  pifri);
2587  cs_solu_f_val(cell_cenj,
2588  i_face_cog,
2589  gradj,
2590  pj,
2591  pjfri);
2592  cs_solu_f_val(cell_cenj,
2593  i_face_cog,
2594  gradj,
2595  pjr,
2596  pjfrj);
2597 
2598  } else {
2599 
2600  /* SOLU
2601  -----*/
2602 
2603  cs_solu_f_val(cell_ceni,
2604  i_face_cog,
2605  gradupi,
2606  pi,
2607  pifrj);
2608  cs_solu_f_val(cell_ceni,
2609  i_face_cog,
2610  gradupi,
2611  pir,
2612  pifri);
2613  cs_solu_f_val(cell_cenj,
2614  i_face_cog,
2615  gradupj,
2616  pj,
2617  pjfri);
2618  cs_solu_f_val(cell_cenj,
2619  i_face_cog,
2620  gradupj,
2621  pjr,
2622  pjfrj);
2623  }
2624  }
2625 
2626  /* Blending
2627  --------*/
2628 
2629  cs_blend_f_val(blencp,
2630  pi,
2631  pifrj);
2632  cs_blend_f_val(blencp,
2633  pir,
2634  pifri);
2635  cs_blend_f_val(blencp,
2636  pj,
2637  pjfri);
2638  cs_blend_f_val(blencp,
2639  pjr,
2640  pjfrj);
2641 
2642  /* If iconv=0 p*fr* are useless */
2643  } else {
2644  cs_upwind_f_val(pi,
2645  pifrj);
2646  cs_upwind_f_val(pir,
2647  pifri);
2648  cs_upwind_f_val(pj,
2649  pjfri);
2650  cs_upwind_f_val(pjr,
2651  pjfrj);
2652  }
2653 
2654 }
2655 
2656 /*----------------------------------------------------------------------------*/
2694 /*----------------------------------------------------------------------------*/
2695 
2696 inline static void
2697 cs_i_cd_steady_slope_test_vector(bool upwind_switch[3],
2698  const int iconvp,
2699  const int ircflp,
2700  const int ischcp,
2701  const double relaxp,
2702  const double blencp,
2703  const cs_real_t weight,
2704  const cs_real_t i_dist,
2705  const cs_real_t i_face_surf,
2706  const cs_real_3_t cell_ceni,
2707  const cs_real_3_t cell_cenj,
2708  const cs_real_3_t i_face_normal,
2709  const cs_real_3_t i_face_cog,
2710  const cs_real_3_t dijpf,
2711  const cs_real_t i_massflux,
2712  const cs_real_33_t gradi,
2713  const cs_real_33_t gradj,
2714  const cs_real_33_t grdpai,
2715  const cs_real_33_t grdpaj,
2716  const cs_real_3_t pi,
2717  const cs_real_3_t pj,
2718  const cs_real_3_t pia,
2719  const cs_real_3_t pja,
2720  cs_real_t pifri[3],
2721  cs_real_t pifrj[3],
2722  cs_real_t pjfri[3],
2723  cs_real_t pjfrj[3],
2724  cs_real_t pip[3],
2725  cs_real_t pjp[3],
2726  cs_real_t pipr[3],
2727  cs_real_t pjpr[3])
2728 {
2729  cs_real_3_t pir, pjr;
2730  cs_real_3_t recoi, recoj;
2731  cs_real_t distf, srfan;
2732  cs_real_3_t testij, tesqck;
2733  int isou;
2734 
2735  distf = i_dist;
2736  srfan = i_face_surf;
2737 
2738  for (isou = 0; isou < 3; isou++) {
2739  upwind_switch[isou] = false;
2740  }
2741 
2743  weight,
2744  cell_ceni,
2745  cell_cenj,
2746  i_face_cog,
2747  dijpf,
2748  gradi,
2749  gradj,
2750  pi,
2751  pj,
2752  recoi,
2753  recoj,
2754  pip,
2755  pjp);
2756 
2757  cs_i_relax_c_val_vector(relaxp,
2758  pia,
2759  pja,
2760  recoi,
2761  recoj,
2762  pi,
2763  pj,
2764  pir,
2765  pjr,
2766  pipr,
2767  pjpr);
2768 
2769  /* Convection slope test is needed only when iconv >0 */
2770  if (iconvp > 0) {
2772  pj,
2773  distf,
2774  srfan,
2775  i_face_normal,
2776  gradi,
2777  gradj,
2778  grdpai,
2779  grdpaj,
2780  i_massflux,
2781  testij,
2782  tesqck);
2783 
2784  for (isou = 0; isou < 3; isou++) {
2785  if (tesqck[isou]<=0. || testij[isou]<=0.) {
2786 
2787  /* Upwind
2788  --------*/
2789 
2790  cs_upwind_f_val(pi[isou],
2791  &pifrj[isou]);
2792  cs_upwind_f_val(pir[isou],
2793  &pifri[isou]);
2794  cs_upwind_f_val(pj[isou],
2795  &pjfri[isou]);
2796  cs_upwind_f_val(pjr[isou],
2797  &pjfrj[isou]);
2798 
2799  upwind_switch[isou] = true;
2800 
2801  } else {
2802 
2803  if (ischcp==1) {
2804 
2805  /* Centered
2806  --------*/
2807 
2808  cs_centered_f_val(weight,
2809  pip[isou],
2810  pjpr[isou],
2811  &pifrj[isou]);
2812  cs_centered_f_val(weight,
2813  pipr[isou],
2814  pjp[isou],
2815  &pifri[isou]);
2816  cs_centered_f_val(weight,
2817  pipr[isou],
2818  pjp[isou],
2819  &pjfri[isou]);
2820  cs_centered_f_val(weight,
2821  pip[isou],
2822  pjpr[isou],
2823  &pjfrj[isou]);
2824 
2825  } else {
2826 
2827  /* Second order
2828  ------------*/
2829 
2830  cs_solu_f_val(cell_ceni,
2831  i_face_cog,
2832  gradi[isou],
2833  pi[isou],
2834  &pifrj[isou]);
2835  cs_solu_f_val(cell_ceni,
2836  i_face_cog,
2837  gradi[isou],
2838  pir[isou],
2839  &pifri[isou]);
2840  cs_solu_f_val(cell_cenj,
2841  i_face_cog,
2842  gradj[isou],
2843  pj[isou],
2844  &pjfri[isou]);
2845  cs_solu_f_val(cell_cenj,
2846  i_face_cog,
2847  gradj[isou],
2848  pjr[isou],
2849  &pjfrj[isou]);
2850 
2851  }
2852  }
2853  }
2854 
2855  /* Blending
2856  --------*/
2857  cs_blend_f_val_vector(blencp,
2858  pi,
2859  pifrj);
2860  cs_blend_f_val_vector(blencp,
2861  pir,
2862  pifri);
2863  cs_blend_f_val_vector(blencp,
2864  pj,
2865  pjfri);
2866  cs_blend_f_val_vector(blencp,
2867  pjr,
2868  pjfrj);
2869 
2870  /* If iconv=0 p*fr* are useless */
2871  } else {
2872  for (isou = 0; isou < 3; isou++) {
2873  cs_upwind_f_val(pi[isou],
2874  &pifrj[isou]);
2875  cs_upwind_f_val(pir[isou],
2876  &pifri[isou]);
2877  cs_upwind_f_val(pj[isou],
2878  &pjfri[isou]);
2879  cs_upwind_f_val(pjr[isou],
2880  &pjfrj[isou]);
2881  }
2882  }
2883 
2884 }
2885 
2886 /*----------------------------------------------------------------------------*/
2924 /*----------------------------------------------------------------------------*/
2925 
2926 inline static void
2927 cs_i_cd_steady_slope_test_tensor(bool upwind_switch[6],
2928  const int iconvp,
2929  const int ircflp,
2930  const int ischcp,
2931  const double relaxp,
2932  const double blencp,
2933  const cs_real_t weight,
2934  const cs_real_t i_dist,
2935  const cs_real_t i_face_surf,
2936  const cs_real_3_t cell_ceni,
2937  const cs_real_3_t cell_cenj,
2938  const cs_real_3_t i_face_normal,
2939  const cs_real_3_t i_face_cog,
2940  const cs_real_3_t dijpf,
2941  const cs_real_t i_massflux,
2942  const cs_real_63_t gradi,
2943  const cs_real_63_t gradj,
2944  const cs_real_63_t grdpai,
2945  const cs_real_63_t grdpaj,
2946  const cs_real_6_t pi,
2947  const cs_real_6_t pj,
2948  const cs_real_6_t pia,
2949  const cs_real_6_t pja,
2950  cs_real_t pifri[6],
2951  cs_real_t pifrj[6],
2952  cs_real_t pjfri[6],
2953  cs_real_t pjfrj[6],
2954  cs_real_t pip[6],
2955  cs_real_t pjp[6],
2956  cs_real_t pipr[6],
2957  cs_real_t pjpr[6])
2958 {
2959  cs_real_6_t pir, pjr;
2960  cs_real_6_t recoi, recoj;
2961  cs_real_t distf, srfan;
2962  cs_real_6_t testij, tesqck;
2963  int isou;
2964 
2965  distf = i_dist;
2966  srfan = i_face_surf;
2967 
2968  for (isou = 0; isou < 6; isou++) {
2969  upwind_switch[isou] = false;
2970  }
2971 
2973  weight,
2974  cell_ceni,
2975  cell_cenj,
2976  i_face_cog,
2977  dijpf,
2978  gradi,
2979  gradj,
2980  pi,
2981  pj,
2982  recoi,
2983  recoj,
2984  pip,
2985  pjp);
2986 
2987  cs_i_relax_c_val_tensor(relaxp,
2988  pia,
2989  pja,
2990  recoi,
2991  recoj,
2992  pi,
2993  pj,
2994  pir,
2995  pjr,
2996  pipr,
2997  pjpr);
2998 
2999  /* Convection slope test is needed only when iconv >0 */
3000  if (iconvp > 0) {
3002  pj,
3003  distf,
3004  srfan,
3005  i_face_normal,
3006  gradi,
3007  gradj,
3008  grdpai,
3009  grdpaj,
3010  i_massflux,
3011  testij,
3012  tesqck);
3013 
3014  for (isou = 0; isou < 6; isou++) {
3015  if (tesqck[isou]<=0. || testij[isou]<=0.) {
3016 
3017  /* Upwind
3018  --------*/
3019 
3020  cs_upwind_f_val(pi[isou],
3021  &pifrj[isou]);
3022  cs_upwind_f_val(pir[isou],
3023  &pifri[isou]);
3024  cs_upwind_f_val(pj[isou],
3025  &pjfri[isou]);
3026  cs_upwind_f_val(pjr[isou],
3027  &pjfrj[isou]);
3028 
3029  upwind_switch[isou] = true;
3030 
3031  } else {
3032 
3033  if (ischcp==1) {
3034 
3035  /* Centered
3036  --------*/
3037 
3038  cs_centered_f_val(weight,
3039  pip[isou],
3040  pjpr[isou],
3041  &pifrj[isou]);
3042  cs_centered_f_val(weight,
3043  pipr[isou],
3044  pjp[isou],
3045  &pifri[isou]);
3046  cs_centered_f_val(weight,
3047  pipr[isou],
3048  pjp[isou],
3049  &pjfri[isou]);
3050  cs_centered_f_val(weight,
3051  pip[isou],
3052  pjpr[isou],
3053  &pjfrj[isou]);
3054 
3055  } else {
3056 
3057  /* Second order
3058  ------------*/
3059 
3060  cs_solu_f_val(cell_ceni,
3061  i_face_cog,
3062  gradi[isou],
3063  pi[isou],
3064  &pifrj[isou]);
3065  cs_solu_f_val(cell_ceni,
3066  i_face_cog,
3067  gradi[isou],
3068  pir[isou],
3069  &pifri[isou]);
3070  cs_solu_f_val(cell_cenj,
3071  i_face_cog,
3072  gradj[isou],
3073  pj[isou],
3074  &pjfri[isou]);
3075  cs_solu_f_val(cell_cenj,
3076  i_face_cog,
3077  gradj[isou],
3078  pjr[isou],
3079  &pjfrj[isou]);
3080 
3081  }
3082  }
3083  }
3084 
3085  /* Blending
3086  --------*/
3087 
3088  cs_blend_f_val_tensor(blencp,
3089  pi,
3090  pifrj);
3091  cs_blend_f_val_tensor(blencp,
3092  pir,
3093  pifri);
3094  cs_blend_f_val_tensor(blencp,
3095  pj,
3096  pjfri);
3097  cs_blend_f_val_tensor(blencp,
3098  pjr,
3099  pjfrj);
3100 
3101  /* If iconv=0 p*fr* are useless */
3102  } else {
3103  for (isou = 0; isou < 6; isou++) {
3104  cs_upwind_f_val(pi[isou],
3105  &pifrj[isou]);
3106  cs_upwind_f_val(pir[isou],
3107  &pifri[isou]);
3108  cs_upwind_f_val(pj[isou],
3109  &pjfri[isou]);
3110  cs_upwind_f_val(pjr[isou],
3111  &pjfrj[isou]);
3112  }
3113  }
3114 
3115 }
3116 
3117 /*----------------------------------------------------------------------------*/
3150 /*----------------------------------------------------------------------------*/
3151 
3152 inline static void
3153 cs_i_cd_unsteady_slope_test(bool *upwind_switch,
3154  const int iconvp,
3155  const int ircflp,
3156  const int ischcp,
3157  const double blencp,
3158  const cs_real_t weight,
3159  const cs_real_t i_dist,
3160  const cs_real_t i_face_surf,
3161  const cs_real_3_t cell_ceni,
3162  const cs_real_3_t cell_cenj,
3163  const cs_real_3_t i_face_normal,
3164  const cs_real_3_t i_face_cog,
3165  const cs_real_3_t dijpf,
3166  const cs_real_t i_massflux,
3167  const cs_real_3_t gradi,
3168  const cs_real_3_t gradj,
3169  const cs_real_3_t gradupi,
3170  const cs_real_3_t gradupj,
3171  const cs_real_3_t gradsti,
3172  const cs_real_3_t gradstj,
3173  const cs_real_t pi,
3174  const cs_real_t pj,
3175  cs_real_t *pif,
3176  cs_real_t *pjf,
3177  cs_real_t *pip,
3178  cs_real_t *pjp)
3179 {
3180  cs_real_t recoi, recoj;
3181  cs_real_t distf, srfan, testij, tesqck;
3182 
3183  distf = i_dist;
3184  srfan = i_face_surf;
3185 
3186  *upwind_switch = false;
3187 
3188  cs_i_compute_quantities(ircflp,
3189  weight,
3190  cell_ceni,
3191  cell_cenj,
3192  i_face_cog,
3193  dijpf,
3194  gradi,
3195  gradj,
3196  pi,
3197  pj,
3198  &recoi,
3199  &recoj,
3200  pip,
3201  pjp);
3202 
3203  /* Convection slope test is needed only when iconv >0 */
3204  if (iconvp > 0) {
3205  cs_slope_test(pi,
3206  pj,
3207  distf,
3208  srfan,
3209  i_face_normal,
3210  gradi,
3211  gradj,
3212  gradsti,
3213  gradstj,
3214  i_massflux,
3215  &testij,
3216  &tesqck);
3217 
3218  if (tesqck<=0. || testij<=0.) {
3219 
3220  /* Upwind
3221  --------*/
3222 
3223  cs_upwind_f_val(pi,
3224  pif);
3225  cs_upwind_f_val(pj,
3226  pjf);
3227 
3228  *upwind_switch = true;
3229 
3230  } else {
3231 
3232  if (ischcp==1) {
3233 
3234  /* Centered
3235  --------*/
3236 
3237  cs_centered_f_val(weight,
3238  *pip,
3239  *pjp,
3240  pif);
3241  cs_centered_f_val(weight,
3242  *pip,
3243  *pjp,
3244  pjf);
3245 
3246  } else if (ischcp == 0) {
3247 
3248  /* Original SOLU
3249  --------------*/
3250 
3251  cs_solu_f_val(cell_ceni,
3252  i_face_cog,
3253  gradi,
3254  pi,
3255  pif);
3256  cs_solu_f_val(cell_cenj,
3257  i_face_cog,
3258  gradj,
3259  pj,
3260  pjf);
3261 
3262  } else {
3263 
3264  /* SOLU
3265  -----*/
3266 
3267  cs_solu_f_val(cell_ceni,
3268  i_face_cog,
3269  gradupi,
3270  pi,
3271  pif);
3272  cs_solu_f_val(cell_cenj,
3273  i_face_cog,
3274  gradupj,
3275  pj,
3276  pjf);
3277 
3278  }
3279  }
3280 
3281  /* Blending
3282  --------*/
3283 
3284  cs_blend_f_val(blencp,
3285  pi,
3286  pif);
3287  cs_blend_f_val(blencp,
3288  pj,
3289  pjf);
3290 
3291  /* If iconv=0 p*f are useless */
3292  } else {
3293  cs_upwind_f_val(pi,
3294  pif);
3295  cs_upwind_f_val(pj,
3296  pjf);
3297  }
3298 
3299 }
3300 
3301 /*----------------------------------------------------------------------------*/
3332 /*----------------------------------------------------------------------------*/
3333 
3334 inline static void
3336  const int iconvp,
3337  const int ircflp,
3338  const int ischcp,
3339  const double blencp,
3340  const cs_real_t weight,
3341  const cs_real_t i_dist,
3342  const cs_real_t i_face_surf,
3343  const cs_real_3_t cell_ceni,
3344  const cs_real_3_t cell_cenj,
3345  const cs_real_3_t i_face_normal,
3346  const cs_real_3_t i_face_cog,
3347  const cs_real_3_t dijpf,
3348  const cs_real_t i_massflux,
3349  const cs_real_33_t gradi,
3350  const cs_real_33_t gradj,
3351  const cs_real_33_t grdpai,
3352  const cs_real_33_t grdpaj,
3353  const cs_real_3_t pi,
3354  const cs_real_3_t pj,
3355  cs_real_t pif[3],
3356  cs_real_t pjf[3],
3357  cs_real_t pip[3],
3358  cs_real_t pjp[3])
3359 {
3360  cs_real_3_t recoi, recoj;
3361  cs_real_t distf, srfan;
3362  cs_real_3_t testij, tesqck;
3363  int isou;
3364 
3365  distf = i_dist;
3366  srfan = i_face_surf;
3367 
3368  for (isou = 0; isou < 3; isou++) {
3369  upwind_switch[isou] = false;
3370  }
3371 
3373  weight,
3374  cell_ceni,
3375  cell_cenj,
3376  i_face_cog,
3377  dijpf,
3378  gradi,
3379  gradj,
3380  pi,
3381  pj,
3382  recoi,
3383  recoj,
3384  pip,
3385  pjp);
3386 
3387  /* Convection slope test is needed only when iconv >0 */
3388  if (iconvp > 0) {
3390  pj,
3391  distf,
3392  srfan,
3393  i_face_normal,
3394  gradi,
3395  gradj,
3396  grdpai,
3397  grdpaj,
3398  i_massflux,
3399  testij,
3400  tesqck);
3401 
3402  /* FIXME: slope test should be done for the vector and not component by
3403  * component. This is conserved for compatibility only. */
3404  for (isou = 0; isou < 3; isou++) {
3405  if (tesqck[isou]<=0. || testij[isou]<=0.) {
3406 
3407  /* Upwind
3408  --------*/
3409 
3410  cs_upwind_f_val(pi[isou],
3411  &pif[isou]);
3412  cs_upwind_f_val(pj[isou],
3413  &pjf[isou]);
3414 
3415  upwind_switch[isou] = true;
3416 
3417  } else {
3418 
3419  if (ischcp==1) {
3420 
3421  /* Centered
3422  --------*/
3423 
3424  cs_centered_f_val(weight,
3425  pip[isou],
3426  pjp[isou],
3427  &pif[isou]);
3428  cs_centered_f_val(weight,
3429  pip[isou],
3430  pjp[isou],
3431  &pjf[isou]);
3432 
3433  } else {
3434 
3435  /* Second order
3436  ------------*/
3437 
3438  cs_solu_f_val(cell_ceni,
3439  i_face_cog,
3440  gradi[isou],
3441  pi[isou],
3442  &pif[isou]);
3443  cs_solu_f_val(cell_cenj,
3444  i_face_cog,
3445  gradj[isou],
3446  pj[isou],
3447  &pjf[isou]);
3448 
3449  }
3450  }
3451  }
3452 
3453  /* Blending
3454  --------*/
3455  cs_blend_f_val_vector(blencp,
3456  pi,
3457  pif);
3458  cs_blend_f_val_vector(blencp,
3459  pj,
3460  pjf);
3461 
3462  /* If iconv=0 p*f are useless */
3463  } else {
3464 
3465  for (isou = 0; isou < 3; isou++) {
3466  cs_upwind_f_val(pi[isou],
3467  &pif[isou]);
3468  cs_upwind_f_val(pj[isou],
3469  &pjf[isou]);
3470 
3471  }
3472  }
3473 }
3474 
3475 /*----------------------------------------------------------------------------*/
3506 /*----------------------------------------------------------------------------*/
3507 
3508 inline static void
3510  const int iconvp,
3511  const int ircflp,
3512  const int ischcp,
3513  const double blencp,
3514  const cs_real_t weight,
3515  const cs_real_t i_dist,
3516  const cs_real_t i_face_surf,
3517  const cs_real_3_t cell_ceni,
3518  const cs_real_3_t cell_cenj,
3519  const cs_real_3_t i_face_normal,
3520  const cs_real_3_t i_face_cog,
3521  const cs_real_3_t dijpf,
3522  const cs_real_t i_massflux,
3523  const cs_real_63_t gradi,
3524  const cs_real_63_t gradj,
3525  const cs_real_63_t grdpai,
3526  const cs_real_63_t grdpaj,
3527  const cs_real_6_t pi,
3528  const cs_real_6_t pj,
3529  cs_real_t pif[6],
3530  cs_real_t pjf[6],
3531  cs_real_t pip[6],
3532  cs_real_t pjp[6])
3533 {
3534  cs_real_6_t recoi, recoj;
3535  cs_real_t distf, srfan;
3536  cs_real_6_t testij, tesqck;
3537  int isou;
3538 
3539  distf = i_dist;
3540  srfan = i_face_surf;
3541 
3542  for (isou = 0; isou < 6; isou++) {
3543  upwind_switch[isou] = false;
3544  }
3545 
3547  weight,
3548  cell_ceni,
3549  cell_cenj,
3550  i_face_cog,
3551  dijpf,
3552  gradi,
3553  gradj,
3554  pi,
3555  pj,
3556  recoi,
3557  recoj,
3558  pip,
3559  pjp);
3560 
3561  /* Convection slope test is needed only when iconv >0 */
3562  if (iconvp > 0) {
3564  pj,
3565  distf,
3566  srfan,
3567  i_face_normal,
3568  gradi,
3569  gradj,
3570  grdpai,
3571  grdpaj,
3572  i_massflux,
3573  testij,
3574  tesqck);
3575  for (isou = 0; isou < 6; isou++) {
3576  if (tesqck[isou]<=0. || testij[isou]<=0.) {
3577 
3578  /* Upwind
3579  --------*/
3580 
3581  cs_upwind_f_val(pi[isou],
3582  &pif[isou]);
3583  cs_upwind_f_val(pj[isou],
3584  &pjf[isou]);
3585 
3586  upwind_switch[isou] = true;
3587 
3588  } else {
3589 
3590  if (ischcp==1) {
3591 
3592  /* Centered
3593  --------*/
3594 
3595  cs_centered_f_val(weight,
3596  pip[isou],
3597  pjp[isou],
3598  &pif[isou]);
3599  cs_centered_f_val(weight,
3600  pip[isou],
3601  pjp[isou],
3602  &pjf[isou]);
3603 
3604  } else {
3605 
3606  /* Second order
3607  ------------*/
3608 
3609  cs_solu_f_val(cell_ceni,
3610  i_face_cog,
3611  gradi[isou],
3612  pi[isou],
3613  &pif[isou]);
3614  cs_solu_f_val(cell_cenj,
3615  i_face_cog,
3616  gradj[isou],
3617  pj[isou],
3618  &pjf[isou]);
3619  }
3620  }
3621  }
3622 
3623  /* Blending
3624  --------*/
3625 
3626  cs_blend_f_val_tensor(blencp,
3627  pi,
3628  pif);
3629  cs_blend_f_val_tensor(blencp,
3630  pj,
3631  pjf);
3632 
3633  /* If iconv=0 p*fr* are useless */
3634  } else {
3635 
3636  for (isou = 0; isou < 6; isou++) {
3637  cs_upwind_f_val(pi[isou],
3638  &pif[isou]);
3639  cs_upwind_f_val(pj[isou],
3640  &pjf[isou]);
3641  }
3642  }
3643 }
3644 
3645 /*----------------------------------------------------------------------------*/
3654 /*----------------------------------------------------------------------------*/
3655 
3656 inline static void
3658  const cs_real_3_t gradi,
3659  const int ircflp,
3660  cs_real_t *recoi)
3661 {
3662  *recoi = ircflp * ( gradi[0]*diipb[0]
3663  + gradi[1]*diipb[1]
3664  + gradi[2]*diipb[2]);
3665 }
3666 
3667 /*----------------------------------------------------------------------------*/
3676 /*----------------------------------------------------------------------------*/
3677 
3678 inline static void
3680  const cs_real_33_t gradi,
3681  const int ircflp,
3682  cs_real_t recoi[3])
3683 {
3684  for (int isou = 0; isou < 3; isou++) {
3685  recoi[isou] = ircflp * (gradi[isou][0]*diipb[0]
3686  + gradi[isou][1]*diipb[1]
3687  + gradi[isou][2]*diipb[2]);
3688  }
3689 }
3690 
3691 /*----------------------------------------------------------------------------*/
3700 /*----------------------------------------------------------------------------*/
3701 
3702 inline static void
3704  const cs_real_63_t gradi,
3705  const int ircflp,
3706  cs_real_t recoi[6])
3707 {
3708  for (int isou = 0; isou < 6; isou++) {
3709  recoi[isou] = ircflp * (gradi[isou][0]*diipb[0]
3710  + gradi[isou][1]*diipb[1]
3711  + gradi[isou][2]*diipb[2]);
3712  }
3713 }
3714 
3715 /*----------------------------------------------------------------------------*/
3726 /*----------------------------------------------------------------------------*/
3727 
3728 inline static void
3729 cs_b_relax_c_val(const double relaxp,
3730  const cs_real_t pi,
3731  const cs_real_t pia,
3732  const cs_real_t recoi,
3733  cs_real_t *pir,
3734  cs_real_t *pipr)
3735 {
3736  *pir = pi/relaxp - (1.-relaxp)/relaxp*pia;
3737  *pipr = *pir + recoi;
3738 }
3739 
3740 /*----------------------------------------------------------------------------*/
3751 /*----------------------------------------------------------------------------*/
3752 
3753 inline static void
3754 cs_b_relax_c_val_vector(const double relaxp,
3755  const cs_real_3_t pi,
3756  const cs_real_3_t pia,
3757  const cs_real_3_t recoi,
3758  cs_real_t pir[3],
3759  cs_real_t pipr[3])
3760 {
3761  for (int isou = 0; isou < 3; isou++) {
3762  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
3763  pipr[isou] = pir[isou] + recoi[isou];
3764  }
3765 }
3766 
3767 /*----------------------------------------------------------------------------*/
3778 /*----------------------------------------------------------------------------*/
3779 
3780 inline static void
3781 cs_b_relax_c_val_tensor(const double relaxp,
3782  const cs_real_6_t pi,
3783  const cs_real_6_t pia,
3784  const cs_real_6_t recoi,
3785  cs_real_t pir[6],
3786  cs_real_t pipr[6])
3787 {
3788  for (int isou = 0; isou < 6; isou++) {
3789  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
3790  pipr[isou] = pir[isou] + recoi[isou];
3791  }
3792 }
3793 
3794 /*----------------------------------------------------------------------------*/
3818 /*----------------------------------------------------------------------------*/
3819 
3820 inline static void
3822  cs_real_t thetap,
3823  int imasac,
3824  int inc,
3825  cs_int_t bc_type,
3826  int icvfli,
3827  cs_real_t pi,
3828  cs_real_t pir,
3829  cs_real_t pipr,
3830  cs_real_t coefap,
3831  cs_real_t coefbp,
3832  cs_real_t coface,
3833  cs_real_t cofbce,
3834  cs_real_t b_massflux,
3835  cs_real_t xcpp,
3836  cs_real_t *flux)
3837 {
3838  cs_real_t flui, fluj, pfac;
3839 
3840  /* Computed convective flux */
3841 
3842  if (icvfli == 0) {
3843 
3844  /* Remove decentering for coupled faces */
3845  if (bc_type == CS_COUPLED_FD) {
3846  flui = 0.0;
3847  fluj = b_massflux;
3848  } else {
3849  flui = 0.5*(b_massflux +fabs(b_massflux));
3850  fluj = 0.5*(b_massflux -fabs(b_massflux));
3851  }
3852 
3853  pfac = inc*coefap + coefbp*pipr;
3854  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
3855 
3856  /* Imposed convective flux */
3857 
3858  } else {
3859 
3860  pfac = inc*coface + cofbce*pipr;
3861  *flux += iconvp*xcpp*(-imasac*(b_massflux*pi) + thetap*(pfac));
3862 
3863  }
3864 }
3865 
3866 /*----------------------------------------------------------------------------*/
3888 /*----------------------------------------------------------------------------*/
3889 
3890 inline static void
3892  cs_real_t thetap,
3893  int imasac,
3894  int inc,
3895  cs_int_t bc_type,
3896  int icvfli,
3897  const cs_real_t pi[restrict 3],
3898  const cs_real_t pir[restrict 3],
3899  const cs_real_t pipr[restrict 3],
3900  const cs_real_t coefap[restrict 3],
3901  const cs_real_t coefbp[restrict 3][3],
3902  const cs_real_t coface[restrict 3],
3903  const cs_real_t cofbce[restrict 3][3],
3904  cs_real_t b_massflux,
3905  cs_real_t flux[restrict 3])
3906 {
3907  cs_real_t flui, fluj, pfac;
3908 
3909  /* Computed convective flux */
3910 
3911  if (icvfli == 0) {
3912 
3913  /* Remove decentering for coupled faces */
3914  if (bc_type == CS_COUPLED_FD) {
3915  flui = 0.0;
3916  fluj = b_massflux;
3917  } else {
3918  flui = 0.5*(b_massflux +fabs(b_massflux));
3919  fluj = 0.5*(b_massflux -fabs(b_massflux));
3920  }
3921  for (int isou = 0; isou < 3; isou++) {
3922  pfac = inc*coefap[isou];
3923  for (int jsou = 0; jsou < 3; jsou++) {
3924  pfac += coefbp[isou][jsou]*pipr[jsou];
3925  }
3926  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
3927  - imasac*b_massflux*pi[isou]);
3928  }
3929 
3930  /* Imposed convective flux */
3931 
3932  } else {
3933 
3934  for (int isou = 0; isou < 3; isou++) {
3935  pfac = inc*coface[isou];
3936  for (int jsou = 0; jsou < 3; jsou++) {
3937  pfac += cofbce[isou][jsou]*pipr[jsou];
3938  }
3939  flux[isou] += iconvp*( thetap*pfac
3940  - imasac*b_massflux*pi[isou]);
3941  }
3942 
3943  }
3944 }
3945 
3946 /*----------------------------------------------------------------------------*/
3966 /*----------------------------------------------------------------------------*/
3967 
3968 inline static void
3969 cs_b_upwind_flux(const int iconvp,
3970  const cs_real_t thetap,
3971  const int imasac,
3972  const int inc,
3973  const int bc_type,
3974  const cs_real_t pi,
3975  const cs_real_t pir,
3976  const cs_real_t pipr,
3977  const cs_real_t coefap,
3978  const cs_real_t coefbp,
3979  const cs_real_t b_massflux,
3980  const cs_real_t xcpp,
3981  cs_real_t *flux)
3982 {
3983  cs_real_t flui, fluj, pfac;
3984 
3985  /* Remove decentering for coupled faces */
3986  if (bc_type == CS_COUPLED_FD) {
3987  flui = 0.0;
3988  fluj = b_massflux;
3989  } else {
3990  flui = 0.5*(b_massflux +fabs(b_massflux));
3991  fluj = 0.5*(b_massflux -fabs(b_massflux));
3992  }
3993 
3994  pfac = inc*coefap + coefbp*pipr;
3995  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
3996 }
3997 
3998 /*----------------------------------------------------------------------------*/
4018 /*----------------------------------------------------------------------------*/
4019 
4020 inline static void
4021 cs_b_upwind_flux_vector(const int iconvp,
4022  const cs_real_t thetap,
4023  const int imasac,
4024  const int inc,
4025  const int bc_type,
4026  const cs_real_3_t pi,
4027  const cs_real_3_t pir,
4028  const cs_real_3_t pipr,
4029  const cs_real_3_t coefa,
4030  const cs_real_33_t coefb,
4031  const cs_real_t b_massflux,
4032  cs_real_t flux[3])
4033 {
4034  cs_real_t flui, fluj, pfac;
4035 
4036  /* Remove decentering for coupled faces */
4037  if (bc_type == CS_COUPLED_FD) {
4038  flui = 0.0;
4039  fluj = b_massflux;
4040  } else {
4041  flui = 0.5*(b_massflux +fabs(b_massflux));
4042  fluj = 0.5*(b_massflux -fabs(b_massflux));
4043  }
4044  for (int isou = 0; isou < 3; isou++) {
4045  pfac = inc*coefa[isou];
4046  for (int jsou = 0; jsou < 3; jsou++) {
4047  pfac += coefb[isou][jsou]*pipr[jsou];
4048  }
4049  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4050  - imasac*b_massflux*pi[isou]);
4051  }
4052 }
4053 
4054 /*----------------------------------------------------------------------------*/
4074 /*----------------------------------------------------------------------------*/
4075 
4076 inline static void
4077 cs_b_upwind_flux_tensor(const int iconvp,
4078  const cs_real_t thetap,
4079  const int imasac,
4080  const int inc,
4081  const int bc_type,
4082  const cs_real_6_t pi,
4083  const cs_real_6_t pir,
4084  const cs_real_6_t pipr,
4085  const cs_real_6_t coefa,
4086  const cs_real_66_t coefb,
4087  const cs_real_t b_massflux,
4088  cs_real_t flux[6])
4089 {
4090  cs_real_t flui, fluj, pfac;
4091 
4092  /* Remove decentering for coupled faces */
4093  if (bc_type == CS_COUPLED_FD) {
4094  flui = 0.0;
4095  fluj = b_massflux;
4096  } else {
4097  flui = 0.5*(b_massflux +fabs(b_massflux));
4098  fluj = 0.5*(b_massflux -fabs(b_massflux));
4099  }
4100  for (int isou = 0; isou < 6; isou++) {
4101  pfac = inc*coefa[isou];
4102  for (int jsou = 0; jsou < 6; jsou++) {
4103  pfac += coefb[isou][jsou]*pipr[jsou];
4104  }
4105  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4106  - imasac*b_massflux*pi[isou]);
4107  }
4108 }
4109 
4110 /*----------------------------------------------------------------------------*/
4123 /*----------------------------------------------------------------------------*/
4124 
4125 inline static void
4126 cs_b_diff_flux(const int idiffp,
4127  const cs_real_t thetap,
4128  const int inc,
4129  const cs_real_t pipr,
4130  const cs_real_t cofafp,
4131  const cs_real_t cofbfp,
4132  const cs_real_t b_visc,
4133  cs_real_t *flux)
4134 {
4135  cs_real_t pfacd = inc*cofafp + cofbfp*pipr;
4136  *flux += idiffp*thetap*b_visc*pfacd;
4137 }
4138 
4139 /*----------------------------------------------------------------------------*/
4152 /*----------------------------------------------------------------------------*/
4153 
4154 inline static void
4155 cs_b_diff_flux_vector(const int idiffp,
4156  const cs_real_t thetap,
4157  const int inc,
4158  const cs_real_3_t pipr,
4159  const cs_real_3_t cofaf,
4160  const cs_real_33_t cofbf,
4161  const cs_real_t b_visc,
4162  cs_real_t flux[3])
4163 {
4164  cs_real_t pfacd ;
4165  for (int isou = 0; isou < 3; isou++) {
4166  pfacd = inc*cofaf[isou];
4167  for (int jsou = 0; jsou < 3; jsou++) {
4168  pfacd += cofbf[isou][jsou]*pipr[jsou];
4169  }
4170  flux[isou] += idiffp*thetap*b_visc*pfacd;
4171  }
4172 }
4173 
4174 /*----------------------------------------------------------------------------*/
4187 /*----------------------------------------------------------------------------*/
4188 
4189 inline static void
4190 cs_b_diff_flux_tensor(const int idiffp,
4191  const cs_real_t thetap,
4192  const int inc,
4193  const cs_real_6_t pipr,
4194  const cs_real_6_t cofaf,
4195  const cs_real_66_t cofbf,
4196  const cs_real_t b_visc,
4197  cs_real_t flux[6])
4198 {
4199  cs_real_t pfacd ;
4200  for (int isou = 0; isou < 6; isou++) {
4201  pfacd = inc*cofaf[isou];
4202  for (int jsou = 0; jsou < 6; jsou++) {
4203  pfacd += cofbf[isou][jsou]*pipr[jsou];
4204  }
4205  flux[isou] += idiffp*thetap*b_visc*pfacd;
4206  }
4207 }
4208 
4209 /*----------------------------------------------------------------------------*/
4223 /*----------------------------------------------------------------------------*/
4224 
4225 inline static void
4226 cs_b_cd_steady(const int ircflp,
4227  const double relaxp,
4228  const cs_real_3_t diipb,
4229  const cs_real_3_t gradi,
4230  const cs_real_t pi,
4231  const cs_real_t pia,
4232  cs_real_t *pir,
4233  cs_real_t *pipr)
4234 {
4235  cs_real_t recoi;
4236 
4238  gradi,
4239  ircflp,
4240  &recoi);
4241 
4242  cs_b_relax_c_val(relaxp,
4243  pi,
4244  pia,
4245  recoi,
4246  pir,
4247  pipr);
4248 }
4249 
4250 /*----------------------------------------------------------------------------*/
4264 /*----------------------------------------------------------------------------*/
4265 
4266 inline static void
4267 cs_b_cd_steady_vector(const int ircflp,
4268  const double relaxp,
4269  const cs_real_3_t diipb,
4270  const cs_real_33_t gradi,
4271  const cs_real_3_t pi,
4272  const cs_real_3_t pia,
4273  cs_real_t pir[3],
4274  cs_real_t pipr[3])
4275 {
4276  cs_real_3_t recoi;
4277 
4279  gradi,
4280  ircflp,
4281  recoi);
4282 
4283  cs_b_relax_c_val_vector(relaxp,
4284  pi,
4285  pia,
4286  recoi,
4287  pir,
4288  pipr);
4289 }
4290 
4291 /*----------------------------------------------------------------------------*/
4305 /*----------------------------------------------------------------------------*/
4306 
4307 inline static void
4308 cs_b_cd_steady_tensor(const int ircflp,
4309  const double relaxp,
4310  const cs_real_3_t diipb,
4311  const cs_real_63_t gradi,
4312  const cs_real_6_t pi,
4313  const cs_real_6_t pia,
4314  cs_real_t pir[6],
4315  cs_real_t pipr[6])
4316 {
4317  cs_real_6_t recoi;
4318 
4320  gradi,
4321  ircflp,
4322  recoi);
4323 
4324  cs_b_relax_c_val_tensor(relaxp,
4325  pi,
4326  pia,
4327  recoi,
4328  pir,
4329  pipr);
4330 }
4331 
4332 /*----------------------------------------------------------------------------*/
4343 /*----------------------------------------------------------------------------*/
4344 
4345 inline static void
4346 cs_b_cd_unsteady(const int ircflp,
4347  const cs_real_3_t diipb,
4348  const cs_real_3_t gradi,
4349  const cs_real_t pi,
4350  cs_real_t *pip)
4351 {
4352  cs_real_t recoi;
4353 
4355  gradi,
4356  ircflp,
4357  &recoi);
4358 
4359  *pip = pi + recoi;
4360 }
4361 
4362 /*----------------------------------------------------------------------------*/
4373 /*----------------------------------------------------------------------------*/
4374 
4375 inline static void
4376 cs_b_cd_unsteady_vector(const int ircflp,
4377  const cs_real_3_t diipb,
4378  const cs_real_33_t gradi,
4379  const cs_real_3_t pi,
4380  cs_real_t pip[3])
4381 {
4382  cs_real_3_t recoi;
4383 
4385  gradi,
4386  ircflp,
4387  recoi);
4388 
4389  for(int isou = 0; isou< 3; isou++)
4390  pip[isou] = pi[isou] + recoi[isou];
4391 }
4392 
4393 /*----------------------------------------------------------------------------*/
4404 /*----------------------------------------------------------------------------*/
4405 
4406 inline static void
4407 cs_b_cd_unsteady_tensor(const int ircflp,
4408  const cs_real_3_t diipb,
4409  const cs_real_63_t gradi,
4410  const cs_real_6_t pi,
4411  cs_real_t pip[6])
4412 {
4413  cs_real_6_t recoi;
4414 
4416  gradi,
4417  ircflp,
4418  recoi);
4419 
4420  for(int isou = 0; isou< 6; isou++)
4421  pip[isou] = pi[isou] + recoi[isou];
4422 }
4423 
4424 /*----------------------------------------------------------------------------*/
4435 /*----------------------------------------------------------------------------*/
4436 
4437 inline static void
4438 cs_b_diff_flux_coupling(const int idiffp,
4439  const cs_real_t pi,
4440  const cs_real_t pj,
4441  const cs_real_t b_visc,
4442  cs_real_t *fluxi)
4443 {
4444  *fluxi += idiffp*b_visc*(pi - pj);
4445 }
4446 
4447 /*============================================================================
4448  * Public function prototypes for Fortran API
4449  *============================================================================*/
4450 
4451 /*----------------------------------------------------------------------------
4452  * Wrapper to cs_face_diffusion_potential
4453  *----------------------------------------------------------------------------*/
4454 
4455 void CS_PROCF (itrmas, ITRMAS)
4456 (
4457  const cs_int_t *const f_id,
4458  const cs_int_t *const init,
4459  const cs_int_t *const inc,
4460  const cs_int_t *const imrgra,
4461  const cs_int_t *const iccocg,
4462  const cs_int_t *const nswrgp,
4463  const cs_int_t *const imligp,
4464  const cs_int_t *const iphydp,
4465  const cs_int_t *const iwgrp,
4466  const cs_int_t *const iwarnp,
4467  const cs_real_t *const epsrgp,
4468  const cs_real_t *const climgp,
4469  const cs_real_t *const extrap,
4470  cs_real_3_t frcxt[],
4471  cs_real_t pvar[],
4472  const cs_real_t coefap[],
4473  const cs_real_t coefbp[],
4474  const cs_real_t cofafp[],
4475  const cs_real_t cofbfp[],
4476  const cs_real_t i_visc[],
4477  const cs_real_t b_visc[],
4478  cs_real_t visel[],
4479  cs_real_t i_massflux[],
4480  cs_real_t b_massflux[]
4481 );
4482 
4483 /*----------------------------------------------------------------------------
4484  * Wrapper to cs_face_anisotropic_diffusion_potential
4485  *----------------------------------------------------------------------------*/
4486 
4487 void CS_PROCF (itrmav, ITRMAV)
4488 (
4489  const cs_int_t *const f_id,
4490  const cs_int_t *const init,
4491  const cs_int_t *const inc,
4492  const cs_int_t *const imrgra,
4493  const cs_int_t *const iccocg,
4494  const cs_int_t *const nswrgp,
4495  const cs_int_t *const imligp,
4496  const cs_int_t *const ircflp,
4497  const cs_int_t *const iphydp,
4498  const cs_int_t *const iwgrp,
4499  const cs_int_t *const iwarnp,
4500  const cs_real_t *const epsrgp,
4501  const cs_real_t *const climgp,
4502  const cs_real_t *const extrap,
4503  cs_real_3_t frcxt[],
4504  cs_real_t pvar[],
4505  const cs_real_t coefap[],
4506  const cs_real_t coefbp[],
4507  const cs_real_t cofafp[],
4508  const cs_real_t cofbfp[],
4509  const cs_real_t i_visc[],
4510  const cs_real_t b_visc[],
4511  cs_real_6_t viscel[],
4512  const cs_real_2_t weighf[],
4513  const cs_real_t weighb[],
4514  cs_real_t i_massflux[],
4515  cs_real_t b_massflux[]
4516 );
4517 
4518 /*----------------------------------------------------------------------------
4519  * Wrapper to cs_diffusion_potential
4520  *----------------------------------------------------------------------------*/
4521 
4522 void CS_PROCF (itrgrp, ITRGRP)
4523 (
4524  const cs_int_t *const f_id,
4525  const cs_int_t *const init,
4526  const cs_int_t *const inc,
4527  const cs_int_t *const imrgra,
4528  const cs_int_t *const iccocg,
4529  const cs_int_t *const nswrgp,
4530  const cs_int_t *const imligp,
4531  const cs_int_t *const iphydp,
4532  const cs_int_t *const iwarnp,
4533  const cs_real_t *const epsrgp,
4534  const cs_real_t *const climgp,
4535  const cs_real_t *const extrap,
4536  cs_real_3_t frcxt[],
4537  cs_real_t pvar[],
4538  const cs_real_t coefap[],
4539  const cs_real_t coefbp[],
4540  const cs_real_t cofafp[],
4541  const cs_real_t cofbfp[],
4542  const cs_real_t i_visc[],
4543  const cs_real_t b_visc[],
4544  cs_real_t visel[],
4545  cs_real_t diverg[]
4546 );
4547 
4548 /*----------------------------------------------------------------------------
4549  * Wrapper to cs_anisotropic_diffusion_potential
4550  *----------------------------------------------------------------------------*/
4551 
4552 void CS_PROCF (itrgrv, ITRGRV)
4553 (
4554  const cs_int_t *const f_id,
4555  const cs_int_t *const init,
4556  const cs_int_t *const inc,
4557  const cs_int_t *const imrgra,
4558  const cs_int_t *const iccocg,
4559  const cs_int_t *const nswrgp,
4560  const cs_int_t *const imligp,
4561  const cs_int_t *const ircflp,
4562  const cs_int_t *const iphydp,
4563  const cs_int_t *const iwarnp,
4564  const cs_real_t *const epsrgp,
4565  const cs_real_t *const climgp,
4566  const cs_real_t *const extrap,
4567  cs_real_3_t frcxt[],
4568  cs_real_t pvar[],
4569  const cs_real_t coefap[],
4570  const cs_real_t coefbp[],
4571  const cs_real_t cofafp[],
4572  const cs_real_t cofbfp[],
4573  const cs_real_t i_visc[],
4574  const cs_real_t b_visc[],
4575  cs_real_6_t viscel[],
4576  const cs_real_2_t weighf[],
4577  const cs_real_t weighb[],
4578  cs_real_t diverg[]
4579 );
4580 
4581 /*=============================================================================
4582  * Public function prototypes
4583  *============================================================================*/
4584 
4585 /*----------------------------------------------------------------------------*/
4604 /*----------------------------------------------------------------------------*/
4605 
4606 void
4607 cs_slope_test_gradient(int f_id,
4608  int inc,
4609  cs_halo_type_t halo_type,
4610  const cs_real_3_t *grad,
4611  cs_real_3_t *grdpa,
4612  const cs_real_t *pvar,
4613  const cs_real_t *coefap,
4614  const cs_real_t *coefbp,
4615  const cs_real_t *i_massflux);
4616 
4617 /*----------------------------------------------------------------------------*/
4633 /*----------------------------------------------------------------------------*/
4634 
4635 void
4636 cs_upwind_gradient(const int f_id,
4637  const int inc,
4638  const cs_halo_type_t halo_type,
4639  const cs_real_t coefap[],
4640  const cs_real_t coefbp[],
4641  const cs_real_t i_massflux[],
4642  const cs_real_t b_massflux[],
4643  const cs_real_t *restrict pvar,
4644  cs_real_3_t *restrict grdpa);
4645 
4646 /*----------------------------------------------------------------------------*/
4664 /*----------------------------------------------------------------------------*/
4665 
4666 void
4667 cs_slope_test_gradient_vector(const int inc,
4668  const cs_halo_type_t halo_type,
4669  const cs_real_33_t *grad,
4670  cs_real_33_t *grdpa,
4671  const cs_real_3_t *pvar,
4672  const cs_real_3_t *coefa,
4673  const cs_real_33_t *coefb,
4674  const cs_real_t *i_massflux);
4675 
4676 /*----------------------------------------------------------------------------*/
4694 /*----------------------------------------------------------------------------*/
4695 
4696 void
4697 cs_slope_test_gradient_tensor(const int inc,
4698  const cs_halo_type_t halo_type,
4699  const cs_real_63_t *grad,
4700  cs_real_63_t *grdpa,
4701  const cs_real_6_t *pvar,
4702  const cs_real_6_t *coefa,
4703  const cs_real_66_t *coefb,
4704  const cs_real_t *i_massflux);
4705 
4706 /*----------------------------------------------------------------------------*/
4715 /*----------------------------------------------------------------------------*/
4716 
4717 void
4718 cs_max_limiter_building(int f_id,
4719  int inc,
4720  const cs_real_t rovsdt[]);
4721 
4722 /*----------------------------------------------------------------------------*/
4774 /*----------------------------------------------------------------------------*/
4775 
4776 void
4778  int f_id,
4779  const cs_var_cal_opt_t var_cal_opt,
4780  int icvflb,
4781  int inc,
4782  int iccocg,
4783  int imasac,
4784  cs_real_t *restrict pvar,
4785  const cs_real_t *restrict pvara,
4786  const cs_int_t icvfli[],
4787  const cs_real_t coefap[],
4788  const cs_real_t coefbp[],
4789  const cs_real_t cofafp[],
4790  const cs_real_t cofbfp[],
4791  const cs_real_t i_massflux[],
4792  const cs_real_t b_massflux[],
4793  const cs_real_t i_visc[],
4794  const cs_real_t b_visc[],
4795  cs_real_t *restrict rhs);
4796 
4797 /*----------------------------------------------------------------------------*/
4856 /*----------------------------------------------------------------------------*/
4857 
4858 void
4860  int f_id,
4861  const cs_var_cal_opt_t var_cal_opt,
4862  int icvflb,
4863  int inc,
4864  int ivisep,
4865  int imasac,
4866  cs_real_3_t *restrict pvar,
4867  const cs_real_3_t *restrict pvara,
4868  const cs_int_t icvfli[],
4869  const cs_real_3_t coefav[],
4870  const cs_real_33_t coefbv[],
4871  const cs_real_3_t cofafv[],
4872  const cs_real_33_t cofbfv[],
4873  const cs_real_t i_massflux[],
4874  const cs_real_t b_massflux[],
4875  const cs_real_t i_visc[],
4876  const cs_real_t b_visc[],
4877  const cs_real_t secvif[],
4878  cs_real_3_t *restrict rhs);
4879 
4880 /*----------------------------------------------------------------------------*/
4925 /*----------------------------------------------------------------------------*/
4926 
4927 void
4929  int f_id,
4930  const cs_var_cal_opt_t var_cal_opt,
4931  int icvflb,
4932  int inc,
4933  int imasac,
4934  cs_real_6_t *restrict pvar,
4935  const cs_real_6_t *restrict pvara,
4936  const cs_real_6_t coefa[],
4937  const cs_real_66_t coefb[],
4938  const cs_real_6_t cofaf[],
4939  const cs_real_66_t cofbf[],
4940  const cs_real_t i_massflux[],
4941  const cs_real_t b_massflux[],
4942  const cs_real_t i_visc[],
4943  const cs_real_t b_visc[],
4944  cs_real_6_t *restrict rhs);
4945 
4946 /*----------------------------------------------------------------------------*/
4992 /*----------------------------------------------------------------------------*/
4993 
4994 void
4996  int f_id,
4997  const cs_var_cal_opt_t var_cal_opt,
4998  int inc,
4999  int iccocg,
5000  int imasac,
5001  cs_real_t *restrict pvar,
5002  const cs_real_t *restrict pvara,
5003  const cs_real_t coefap[],
5004  const cs_real_t coefbp[],
5005  const cs_real_t cofafp[],
5006  const cs_real_t cofbfp[],
5007  const cs_real_t i_massflux[],
5008  const cs_real_t b_massflux[],
5009  const cs_real_t i_visc[],
5010  const cs_real_t b_visc[],
5011  const cs_real_t xcpp[],
5012  cs_real_t *restrict rhs);
5013 
5014 /*----------------------------------------------------------------------------*/
5062 /*----------------------------------------------------------------------------*/
5063 
5064 void
5066  int f_id,
5067  const cs_var_cal_opt_t var_cal_opt,
5068  int inc,
5069  int iccocg,
5070  cs_real_t *restrict pvar,
5071  const cs_real_t *restrict pvara,
5072  const cs_real_t coefap[],
5073  const cs_real_t coefbp[],
5074  const cs_real_t cofafp[],
5075  const cs_real_t cofbfp[],
5076  const cs_real_t i_visc[],
5077  const cs_real_t b_visc[],
5078  cs_real_6_t *restrict viscel,
5079  const cs_real_2_t weighf[],
5080  const cs_real_t weighb[],
5081  cs_real_t *restrict rhs);
5082 
5083 /*-----------------------------------------------------------------------------*/
5126 /*----------------------------------------------------------------------------*/
5127 
5128 void
5130  int f_id,
5131  const cs_var_cal_opt_t var_cal_opt,
5132  int inc,
5133  int ivisep,
5134  cs_real_3_t *restrict pvar,
5135  const cs_real_3_t *restrict pvara,
5136  const cs_real_3_t coefav[],
5137  const cs_real_33_t coefbv[],
5138  const cs_real_3_t cofafv[],
5139  const cs_real_33_t cofbfv[],
5140  const cs_real_33_t i_visc[],
5141  const cs_real_t b_visc[],
5142  const cs_real_t secvif[],
5143  cs_real_3_t *restrict rhs);
5144 
5145 /*----------------------------------------------------------------------------*/
5189 /*----------------------------------------------------------------------------*/
5190 
5191 void
5193  int f_id,
5194  const cs_var_cal_opt_t var_cal_opt,
5195  int inc,
5196  cs_real_6_t *restrict pvar,
5197  const cs_real_6_t *restrict pvara,
5198  const cs_real_6_t coefa[],
5199  const cs_real_66_t coefb[],
5200  const cs_real_6_t cofaf[],
5201  const cs_real_66_t cofbf[],
5202  const cs_real_t i_visc[],
5203  const cs_real_t b_visc[],
5204  cs_real_6_t *restrict viscel,
5205  const cs_real_2_t weighf[],
5206  const cs_real_t weighb[],
5207  cs_real_6_t *restrict rhs);
5208 
5209 /*----------------------------------------------------------------------------*/
5269 /*----------------------------------------------------------------------------*/
5270 
5271 void
5272 cs_face_diffusion_potential(const int f_id,
5273  const cs_mesh_t *m,
5274  cs_mesh_quantities_t *fvq,
5275  int init,
5276  int inc,
5277  int imrgra,
5278  int iccocg,
5279  int nswrgp,
5280  int imligp,
5281  int iphydp,
5282  int iwgrp,
5283  int iwarnp,
5284  double epsrgp,
5285  double climgp,
5286  double extrap,
5287  cs_real_3_t *restrict frcxt,
5288  cs_real_t *restrict pvar,
5289  const cs_real_t coefap[],
5290  const cs_real_t coefbp[],
5291  const cs_real_t cofafp[],
5292  const cs_real_t cofbfp[],
5293  const cs_real_t i_visc[],
5294  const cs_real_t b_visc[],
5295  cs_real_t *restrict visel,
5296  cs_real_t *restrict i_massflux,
5297  cs_real_t *restrict b_massflux);
5298 
5299 /*----------------------------------------------------------------------------*/
5370 /*----------------------------------------------------------------------------*/
5371 
5372 void
5374  const cs_mesh_t *m,
5375  cs_mesh_quantities_t *fvq,
5376  int init,
5377  int inc,
5378  int imrgra,
5379  int iccocg,
5380  int nswrgp,
5381  int imligp,
5382  int ircflp,
5383  int iphydp,
5384  int iwgrp,
5385  int iwarnp,
5386  double epsrgp,
5387  double climgp,
5388  double extrap,
5389  cs_real_3_t *restrict frcxt,
5390  cs_real_t *restrict pvar,
5391  const cs_real_t coefap[],
5392  const cs_real_t coefbp[],
5393  const cs_real_t cofafp[],
5394  const cs_real_t cofbfp[],
5395  const cs_real_t i_visc[],
5396  const cs_real_t b_visc[],
5397  cs_real_6_t *restrict viscel,
5398  const cs_real_2_t weighf[],
5399  const cs_real_t weighb[],
5400  cs_real_t *restrict i_massflux,
5401  cs_real_t *restrict b_massflux);
5402 
5403 /*----------------------------------------------------------------------------*/
5459 /*----------------------------------------------------------------------------*/
5460 
5461 void
5462 cs_diffusion_potential(const int f_id,
5463  const cs_mesh_t *m,
5464  cs_mesh_quantities_t *fvq,
5465  int init,
5466  int inc,
5467  int imrgra,
5468  int iccocg,
5469  int nswrgp,
5470  int imligp,
5471  int iphydp,
5472  int iwarnp,
5473  double epsrgp,
5474  double climgp,
5475  double extrap,
5476  cs_real_3_t *restrict frcxt,
5477  cs_real_t *restrict pvar,
5478  const cs_real_t coefap[],
5479  const cs_real_t coefbp[],
5480  const cs_real_t cofafp[],
5481  const cs_real_t cofbfp[],
5482  const cs_real_t i_visc[],
5483  const cs_real_t b_visc[],
5484  cs_real_t visel[],
5485  cs_real_t *restrict diverg);
5486 
5487 /*----------------------------------------------------------------------------*/
5556 /*----------------------------------------------------------------------------*/
5557 
5558 void
5559 cs_anisotropic_diffusion_potential(const int f_id,
5560  const cs_mesh_t *m,
5561  cs_mesh_quantities_t *fvq,
5562  int init,
5563  int inc,
5564  int imrgra,
5565  int iccocg,
5566  int nswrgp,
5567  int imligp,
5568  int ircflp,
5569  int iphydp,
5570  int iwarnp,
5571  double epsrgp,
5572  double climgp,
5573  double extrap,
5574  cs_real_3_t *restrict frcxt,
5575  cs_real_t *restrict pvar,
5576  const cs_real_t coefap[],
5577  const cs_real_t coefbp[],
5578  const cs_real_t cofafp[],
5579  const cs_real_t cofbfp[],
5580  const cs_real_t i_visc[],
5581  const cs_real_t b_visc[],
5582  cs_real_6_t *restrict viscel,
5583  const cs_real_2_t weighf[],
5584  const cs_real_t weighb[],
5585  cs_real_t *restrict diverg);
5586 
5587 /*----------------------------------------------------------------------------*/
5588 
5590 
5591 #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:4226
static void cs_i_cd_unsteady_slope_test_tensor(bool upwind_switch[6], 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_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:3509
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:642
double precision, dimension(:,:), pointer diipb
Definition: mesh.f90:216
#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:154
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:3891
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:4190
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:2098
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:7871
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:719
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:6610
integer, dimension(:), allocatable icvfli
Definition: cfpoin.f90:48
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:4267
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:659
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:4346
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:1240
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:1680
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:3821
double precision pi
value with 16 digits
Definition: cstnum.f90:48
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:296
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:1945
Definition: cs_parameters.h:141
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:595
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:517
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:1525
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:678
integer(c_int), pointer, save idtvar
option for a variable time step
Definition: optcal.f90:532
static void cs_i_cd_steady_slope_test_vector(bool upwind_switch[3], 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:2697
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:1791
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&#39; at boundary cell i.
Definition: cs_convection_diffusion.h:3679
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:1099
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:852
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&#39; and J&#39;.
Definition: cs_convection_diffusion.h:365
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:801
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 grdpai, const cs_real_33_t grdpaj, const cs_real_t i_massflux, cs_real_t testij[3], cs_real_t tesqck[3])
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:170
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:769
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:4021
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:89
Definition: cs_mesh.h:63
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:1039
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 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:2447
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:3336
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&#39; and J&#39;.
Definition: cs_convection_diffusion.h:442
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:4155
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:555
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:1102
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:3781
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:2325
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:3729
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:1333
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_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:7326
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:741
Definition: cs_mesh_quantities.h:52
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:8830
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:3969
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:9689
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&#39; at boundary cell i.
Definition: cs_convection_diffusion.h:3703
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:1477
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 grdpai, const cs_real_63_t grdpaj, const cs_real_t i_massflux, cs_real_t testij[6], cs_real_t tesqck[6])
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:236
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:905
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:698
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:4407
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:8472
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:4438
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:4077
static void cs_i_cd_unsteady_slope_test_vector(bool upwind_switch[3], 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])
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition: cs_convection_diffusion.h:3335
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:1244
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:949
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:997
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:4495
structure containing the variable calculation options.
Definition: cs_parameters.h:59
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&#39; at boundary cell i.
Definition: cs_convection_diffusion.h:3657
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:1069
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:1609
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:1158
Definition: cs_convection_diffusion.h:69
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:967
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:9298
#define END_C_DECLS
Definition: cs_defs.h:452
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:1148
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&#39; and J&#39;.
Definition: cs_convection_diffusion.h:304
#define CS_PROCF(x, y)
Definition: cs_defs.h:465
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_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:2221
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:1537
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:315
static void cs_i_cd_unsteady_slope_test(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_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:3153
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:1977
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:873
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:320
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:4376
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:1418
double precision, dimension(:,:), pointer dijpf
Definition: mesh.f90:208
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:4308
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:1826
static void cs_i_cd_steady_slope_test_tensor(bool upwind_switch[6], 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_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:2927
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:626
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:5413
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:4126
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:1393
Definition: cs_convection_diffusion.h:68
integer(c_int), pointer, save imrgra
type of gradient reconstruction
Definition: optcal.f90:353
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:1030
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:3754
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:832
Definition: cs_convection_diffusion.h:72