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  * Macro definitions
48  *============================================================================*/
49 
56 /*
57  * Field property type
58  */
59 
61 #define CS_ISOTROPIC_DIFFUSION (1 << 0)
62 
64 #define CS_ORTHOTROPIC_DIFFUSION (1 << 1)
65 
67 #define CS_ANISOTROPIC_LEFT_DIFFUSION (1 << 2)
68 
70 #define CS_ANISOTROPIC_RIGHT_DIFFUSION (1 << 3)
71 
73 #define CS_ANISOTROPIC_DIFFUSION ((1 << 2) + (1 << 3))
74 
77 /*============================================================================
78  * Type definition
79  *============================================================================*/
80 
81 /*----------------------------------------------------------------------------
82  * NVD/TVD Advection Scheme
83  *----------------------------------------------------------------------------*/
84 
85 typedef enum {
86 
87  CS_NVD_GAMMA = 0, /* GAMMA */
88  CS_NVD_SMART = 1, /* SMART */
89  CS_NVD_CUBISTA = 2, /* CUBISTA */
90  CS_NVD_SUPERBEE = 3, /* SUPERBEE */
91  CS_NVD_MUSCL = 4, /* MUSCL */
92  CS_NVD_MINMOD = 5, /* MINMOD */
93  CS_NVD_CLAM = 6, /* CLAM */
94  CS_NVD_STOIC = 7, /* STOIC */
95  CS_NVD_OSHER = 8, /* OSHER */
96  CS_NVD_WASEB = 9, /* WASEB */
97  CS_NVD_VOF_HRIC = 10, /* M-HRIC for VOF */
98  CS_NVD_VOF_CICSAM = 11, /* M-CICSAM for VOF */
99  CS_NVD_VOF_STACS = 12, /* STACS for VOF */
100  CS_NVD_N_TYPES = 13 /* number of NVD schemes */
101 
102 } cs_nvd_type_t;
103 
104 /*============================================================================
105  * Global variables
106  *============================================================================*/
107 
108 /*============================================================================
109  * Private function definitions
110  *============================================================================*/
111 
112 /*----------------------------------------------------------------------------*/
129 /*----------------------------------------------------------------------------*/
130 
131 inline static void
133  const cs_real_t pj,
134  const cs_real_t distf,
135  const cs_real_t srfan,
136  const cs_real_3_t i_face_normal,
137  const cs_real_3_t gradi,
138  const cs_real_3_t gradj,
139  const cs_real_3_t grdpai,
140  const cs_real_3_t grdpaj,
141  const cs_real_t i_massflux,
142  double *testij,
143  double *tesqck)
144 {
145  double testi, testj;
146  double dcc, ddi, ddj;
147 
148  /* Slope test
149  ----------*/
150 
151  testi = grdpai[0]*i_face_normal[0]
152  + grdpai[1]*i_face_normal[1]
153  + grdpai[2]*i_face_normal[2];
154  testj = grdpaj[0]*i_face_normal[0]
155  + grdpaj[1]*i_face_normal[1]
156  + grdpaj[2]*i_face_normal[2];
157  *testij = grdpai[0]*grdpaj[0]
158  + grdpai[1]*grdpaj[1]
159  + grdpai[2]*grdpaj[2];
160 
161  if (i_massflux>0.) {
162  dcc = gradi[0]*i_face_normal[0]
163  + gradi[1]*i_face_normal[1]
164  + gradi[2]*i_face_normal[2];
165  ddi = testi;
166  ddj = (pj-pi)/distf *srfan;
167  } else {
168  dcc = gradj[0]*i_face_normal[0]
169  + gradj[1]*i_face_normal[1]
170  + gradj[2]*i_face_normal[2];
171  ddi = (pj-pi)/distf *srfan;
172  ddj = testj;
173  }
174  *tesqck = cs_math_sq(dcc) - cs_math_sq(ddi-ddj);
175 }
176 
177 /*----------------------------------------------------------------------------*/
194 /*----------------------------------------------------------------------------*/
195 
196 inline static void
198  const cs_real_3_t pj,
199  const cs_real_t distf,
200  const cs_real_t srfan,
201  const cs_real_3_t i_face_normal,
202  const cs_real_33_t gradi,
203  const cs_real_33_t gradj,
204  const cs_real_33_t gradsti,
205  const cs_real_33_t gradstj,
206  const cs_real_t i_massflux,
207  cs_real_t *testij,
208  cs_real_t *tesqck)
209 {
210  double testi[3], testj[3];
211  double dcc[3], ddi[3], ddj[3];
212  *testij = 0.;
213  *tesqck = 0.;
214 
215  /* Slope test
216  ----------*/
217  for (int i = 0; i < 3; i++) {
218  *testij += gradsti[i][0]*gradstj[i][0]
219  + gradsti[i][1]*gradstj[i][1]
220  + gradsti[i][2]*gradstj[i][2];
221 
222  testi[i] = gradsti[i][0]*i_face_normal[0]
223  + gradsti[i][1]*i_face_normal[1]
224  + gradsti[i][2]*i_face_normal[2];
225  testj[i] = gradstj[i][0]*i_face_normal[0]
226  + gradstj[i][1]*i_face_normal[1]
227  + gradstj[i][2]*i_face_normal[2];
228 
229  if (i_massflux > 0.) {
230  dcc[i] = gradi[i][0]*i_face_normal[0]
231  + gradi[i][1]*i_face_normal[1]
232  + gradi[i][2]*i_face_normal[2];
233  ddi[i] = testi[i];
234  ddj[i] = (pj[i]-pi[i])/distf *srfan;
235  } else {
236  dcc[i] = gradj[i][0]*i_face_normal[0]
237  + gradj[i][1]*i_face_normal[1]
238  + gradj[i][2]*i_face_normal[2];
239  ddi[i] = (pj[i]-pi[i])/distf *srfan;
240  ddj[i] = testj[i];
241  }
242  }
243 
244  *tesqck = cs_math_3_square_norm(dcc) - cs_math_3_square_distance(ddi, ddj);
245 
246 }
247 
248 /*----------------------------------------------------------------------------*/
266 /*----------------------------------------------------------------------------*/
267 
268 inline static void
270  const cs_real_3_t pj,
271  const cs_real_t distf,
272  const cs_real_t srfan,
273  const cs_real_3_t i_face_normal,
274  const cs_real_33_t gradi,
275  const cs_real_33_t gradj,
276  const cs_real_33_t grdpai,
277  const cs_real_33_t grdpaj,
278  const cs_real_t i_massflux,
279  cs_real_t testij[3],
280  cs_real_t tesqck[3])
281 {
282  double testi[3], testj[3];
283  double dcc[3], ddi[3], ddj[3];
284 
285  /* Slope test
286  ----------*/
287  for (int isou = 0; isou < 3; isou++) {
288  testi[isou] = grdpai[isou][0]*i_face_normal[0]
289  + grdpai[isou][1]*i_face_normal[1]
290  + grdpai[isou][2]*i_face_normal[2];
291  testj[isou] = grdpaj[isou][0]*i_face_normal[0]
292  + grdpaj[isou][1]*i_face_normal[1]
293  + grdpaj[isou][2]*i_face_normal[2];
294  testij[isou] = grdpai[isou][0]*grdpaj[isou][0]
295  + grdpai[isou][1]*grdpaj[isou][1]
296  + grdpai[isou][2]*grdpaj[isou][2];
297 
298  if (i_massflux>0.) {
299  dcc[isou] = gradi[isou][0]*i_face_normal[0]
300  + gradi[isou][1]*i_face_normal[1]
301  + gradi[isou][2]*i_face_normal[2];
302  ddi[isou] = testi[isou];
303  ddj[isou] = (pj[isou]-pi[isou])/distf *srfan;
304  } else {
305  dcc[isou] = gradj[isou][0]*i_face_normal[0]
306  + gradj[isou][1]*i_face_normal[1]
307  + gradj[isou][2]*i_face_normal[2];
308  ddi[isou] = (pj[isou]-pi[isou])/distf *srfan;
309  ddj[isou] = testj[isou];
310  }
311  tesqck[isou] = cs_math_sq(dcc[isou]) - cs_math_sq(ddi[isou]-ddj[isou]);
312  }
313 }
314 
315 
316 /*----------------------------------------------------------------------------*/
333 /*----------------------------------------------------------------------------*/
334 
335 inline static void
337  const cs_real_6_t pj,
338  const cs_real_t distf,
339  const cs_real_t srfan,
340  const cs_real_3_t i_face_normal,
341  const cs_real_63_t gradi,
342  const cs_real_63_t gradj,
343  const cs_real_63_t gradsti,
344  const cs_real_63_t gradstj,
345  const cs_real_t i_massflux,
346  cs_real_t *testij,
347  cs_real_t *tesqck)
348 {
349  double testi[6], testj[6];
350  double dcc[6], ddi[6], ddj[6];
351  *testij = 0.;
352  *tesqck = 0.;
353 
354  /* Slope test */
355 
356  for (int ij = 0; ij < 6; ij++) {
357  *testij += gradsti[ij][0]*gradstj[ij][0]
358  + gradsti[ij][1]*gradstj[ij][1]
359  + gradsti[ij][2]*gradstj[ij][2];
360  testi[ij] = gradsti[ij][0]*i_face_normal[0]
361  + gradsti[ij][1]*i_face_normal[1]
362  + gradsti[ij][2]*i_face_normal[2];
363  testj[ij] = gradstj[ij][0]*i_face_normal[0]
364  + gradstj[ij][1]*i_face_normal[1]
365  + gradstj[ij][2]*i_face_normal[2];
366 
367  if (i_massflux > 0.) {
368  dcc[ij] = gradi[ij][0]*i_face_normal[0]
369  + gradi[ij][1]*i_face_normal[1]
370  + gradi[ij][2]*i_face_normal[2];
371  ddi[ij] = testi[ij];
372  ddj[ij] = (pj[ij]-pi[ij])/distf *srfan;
373  } else {
374  dcc[ij] = gradj[ij][0]*i_face_normal[0]
375  + gradj[ij][1]*i_face_normal[1]
376  + gradj[ij][2]*i_face_normal[2];
377  ddi[ij] = (pj[ij]-pi[ij])/distf *srfan;
378  ddj[ij] = testj[ij];
379  }
380 
381  *tesqck += cs_math_sq(dcc[ij]) - cs_math_sq(ddi[ij]-ddj[ij]);
382  }
383 }
384 
385 /*----------------------------------------------------------------------------*/
401 /*----------------------------------------------------------------------------*/
402 
403 inline static void
404 cs_i_compute_quantities(const int ircflp,
405  const cs_real_3_t diipf,
406  const cs_real_3_t djjpf,
407  const cs_real_3_t gradi,
408  const cs_real_3_t gradj,
409  const cs_real_t pi,
410  const cs_real_t pj,
411  cs_real_t *recoi,
412  cs_real_t *recoj,
413  cs_real_t *pip,
414  cs_real_t *pjp)
415 {
416  cs_real_t gradpf[3] = {
417  0.5*(gradi[0] + gradj[0]),
418  0.5*(gradi[1] + gradj[1]),
419  0.5*(gradi[2] + gradj[2])};
420 
421  /* reconstruction only if IRCFLP = 1 */
422  *recoi = ircflp*(cs_math_3_dot_product(gradpf, diipf));
423  *recoj = ircflp*(cs_math_3_dot_product(gradpf, djjpf));
424  *pip = pi + *recoi;
425  *pjp = pj + *recoj;
426 }
427 
428 /*----------------------------------------------------------------------------*/
444 /*----------------------------------------------------------------------------*/
445 
446 inline static void
448  const cs_real_3_t diipf,
449  const cs_real_3_t djjpf,
450  const cs_real_33_t gradi,
451  const cs_real_33_t gradj,
452  const cs_real_3_t pi,
453  const cs_real_3_t pj,
454  cs_real_t recoi[3],
455  cs_real_t recoj[3],
456  cs_real_t pip[3],
457  cs_real_t pjp[3])
458 {
459  cs_real_3_t dpvf;
460 
461  /* x-y-z components, p = u, v, w */
462 
463  for (int isou = 0; isou < 3; isou++) {
464 
465  for (int jsou = 0; jsou < 3; jsou++)
466  dpvf[jsou] = 0.5*( gradi[isou][jsou]
467  + gradj[isou][jsou]);
468 
469  /* reconstruction only if IRCFLP = 1 */
470 
471  recoi[isou] = ircflp*(cs_math_3_dot_product(dpvf, diipf));
472 
473 
474  recoj[isou] = ircflp*(cs_math_3_dot_product(dpvf, djjpf));
475 
476  pip[isou] = pi[isou] + recoi[isou];
477 
478  pjp[isou] = pj[isou] + recoj[isou];
479 
480  }
481 }
482 
483 /*----------------------------------------------------------------------------*/
499 /*----------------------------------------------------------------------------*/
500 
501 inline static void
503  const cs_real_3_t diipf,
504  const cs_real_3_t djjpf,
505  const cs_real_63_t gradi,
506  const cs_real_63_t gradj,
507  const cs_real_6_t pi,
508  const cs_real_6_t pj,
509  cs_real_t recoi[6],
510  cs_real_t recoj[6],
511  cs_real_t pip[6],
512  cs_real_t pjp[6])
513 {
514  cs_real_3_t dpvf;
515 
516  /* x-y-z components, p = u, v, w */
517 
518  for (int isou = 0; isou < 6; isou++) {
519 
520  for (int jsou = 0; jsou < 3; jsou++)
521  dpvf[jsou] = 0.5*( gradi[isou][jsou]
522  + gradj[isou][jsou]);
523 
524  /* reconstruction only if IRCFLP = 1 */
525 
526  recoi[isou] = ircflp*(cs_math_3_dot_product(dpvf, diipf));
527 
528  recoj[isou] = ircflp*(cs_math_3_dot_product(dpvf, djjpf));
529 
530  pip[isou] = pi[isou] + recoi[isou];
531 
532  pjp[isou] = pj[isou] + recoj[isou];
533 
534  }
535 }
536 
537 /*----------------------------------------------------------------------------*/
553 /*----------------------------------------------------------------------------*/
554 
555 inline static void
556 cs_i_relax_c_val(const double relaxp,
557  const cs_real_t pia,
558  const cs_real_t pja,
559  const cs_real_t recoi,
560  const cs_real_t recoj,
561  const cs_real_t pi,
562  const cs_real_t pj,
563  cs_real_t *pir,
564  cs_real_t *pjr,
565  cs_real_t *pipr,
566  cs_real_t *pjpr)
567 {
568  *pir = pi/relaxp - (1.-relaxp)/relaxp * pia;
569  *pjr = pj/relaxp - (1.-relaxp)/relaxp * pja;
570 
571  *pipr = *pir + recoi;
572  *pjpr = *pjr + recoj;
573 }
574 
575 /*----------------------------------------------------------------------------*/
591 /*----------------------------------------------------------------------------*/
592 
593 inline static void
594 cs_i_relax_c_val_vector(const double relaxp,
595  const cs_real_3_t pia,
596  const cs_real_3_t pja,
597  const cs_real_3_t recoi,
598  const cs_real_3_t recoj,
599  const cs_real_3_t pi,
600  const cs_real_3_t pj,
601  cs_real_t pir[3],
602  cs_real_t pjr[3],
603  cs_real_t pipr[3],
604  cs_real_t pjpr[3])
605 {
606  for (int isou = 0; isou < 3; isou++) {
607  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
608  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
609 
610  pipr[isou] = pir[isou] + recoi[isou];
611  pjpr[isou] = pjr[isou] + recoj[isou];
612  }
613 }
614 
615 /*----------------------------------------------------------------------------*/
631 /*----------------------------------------------------------------------------*/
632 
633 inline static void
634 cs_i_relax_c_val_tensor(const double relaxp,
635  const cs_real_6_t pia,
636  const cs_real_6_t pja,
637  const cs_real_6_t recoi,
638  const cs_real_6_t recoj,
639  const cs_real_6_t pi,
640  const cs_real_6_t pj,
641  cs_real_t pir[6],
642  cs_real_t pjr[6],
643  cs_real_t pipr[6],
644  cs_real_t pjpr[6])
645 {
646  for (int isou = 0; isou < 6; isou++) {
647  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
648  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
649 
650  pipr[isou] = pir[isou] + recoi[isou];
651  pjpr[isou] = pjr[isou] + recoj[isou];
652  }
653 }
654 
655 /*----------------------------------------------------------------------------*/
662 /*----------------------------------------------------------------------------*/
663 
664 inline static void
666  cs_real_t *pf)
667 {
668  *pf = p;
669 }
670 
671 /*----------------------------------------------------------------------------*/
678 /*----------------------------------------------------------------------------*/
679 
680 inline static void
682  cs_real_t pf[3])
683 {
684  for (int isou = 0; isou < 3; isou++)
685  pf[isou] = p[isou];
686 }
687 
688 /*----------------------------------------------------------------------------*/
695 /*----------------------------------------------------------------------------*/
696 
697 inline static void
699  cs_real_t pf[6])
700 {
701  for (int isou = 0; isou < 6; isou++)
702  pf[isou] = p[isou];
703 }
704 
705 /*----------------------------------------------------------------------------*/
714 /*----------------------------------------------------------------------------*/
715 
716 inline static void
717 cs_centered_f_val(const double pnd,
718  const cs_real_t pip,
719  const cs_real_t pjp,
720  cs_real_t *pf)
721 {
722  *pf = pnd*pip + (1.-pnd)*pjp;
723 }
724 
725 /*----------------------------------------------------------------------------*/
734 /*----------------------------------------------------------------------------*/
735 
736 inline static void
737 cs_centered_f_val_vector(const double pnd,
738  const cs_real_3_t pip,
739  const cs_real_3_t pjp,
740  cs_real_t pf[3])
741 {
742  for (int isou = 0; isou < 3; isou++)
743  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
744 }
745 
746 /*----------------------------------------------------------------------------*/
755 /*----------------------------------------------------------------------------*/
756 
757 inline static void
758 cs_centered_f_val_tensor(const double pnd,
759  const cs_real_6_t pip,
760  const cs_real_6_t pjp,
761  cs_real_t pf[6])
762 {
763  for (int isou = 0; isou < 6; isou++)
764  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
765 }
766 
767 /*----------------------------------------------------------------------------*/
777 /*----------------------------------------------------------------------------*/
778 
779 inline static void
780 cs_solu_f_val(const cs_real_3_t cell_cen,
781  const cs_real_3_t i_face_cog,
782  const cs_real_3_t grad,
783  const cs_real_t p,
784  cs_real_t *pf)
785 {
786  cs_real_3_t df;
787 
788  df[0] = i_face_cog[0] - cell_cen[0];
789  df[1] = i_face_cog[1] - cell_cen[1];
790  df[2] = i_face_cog[2] - cell_cen[2];
791 
792  *pf = p + cs_math_3_dot_product(df, grad);
793 }
794 
795 /*----------------------------------------------------------------------------*/
805 /*----------------------------------------------------------------------------*/
806 
807 inline static void
809  const cs_real_3_t i_face_cog,
810  const cs_real_33_t grad,
811  const cs_real_3_t p,
812  cs_real_t pf[3])
813 {
814  cs_real_3_t df;
815 
816  for (int jsou = 0; jsou < 3; jsou++)
817  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
818 
819  for (int isou = 0; isou < 3; isou++) {
820  pf[isou] = p[isou] + df[0]*grad[isou][0]
821  + df[1]*grad[isou][1]
822  + df[2]*grad[isou][2];
823 
824  }
825 }
826 
827 /*----------------------------------------------------------------------------*/
837 /*----------------------------------------------------------------------------*/
838 
839 inline static void
841  const cs_real_3_t i_face_cog,
842  const cs_real_63_t grad,
843  const cs_real_6_t p,
844  cs_real_t pf[6])
845 {
846  cs_real_3_t df;
847 
848  for (int jsou = 0; jsou < 3; jsou++)
849  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
850 
851  for (int isou = 0; isou < 6; isou++) {
852  pf[isou] = p[isou] + df[0]*grad[isou][0]
853  + df[1]*grad[isou][1]
854  + df[2]*grad[isou][2];
855  }
856 }
857 
858 /*----------------------------------------------------------------------------*/
868 /*----------------------------------------------------------------------------*/
869 
870 inline static void
871 cs_blend_f_val(const double blencp,
872  const cs_real_t p,
873  cs_real_t *pf)
874 {
875  *pf = blencp * (*pf) + (1. - blencp) * p;
876 }
877 
878 /*----------------------------------------------------------------------------*/
888 /*----------------------------------------------------------------------------*/
889 
890 inline static void
891 cs_blend_f_val_vector(const double blencp,
892  const cs_real_3_t p,
893  cs_real_t pf[3])
894 {
895  for (int isou = 0; isou < 3; isou++)
896  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
897 }
898 
899 /*----------------------------------------------------------------------------*/
909 /*----------------------------------------------------------------------------*/
910 
911 inline static void
912 cs_blend_f_val_tensor(const double blencp,
913  const cs_real_6_t p,
914  cs_real_t pf[6])
915 {
916  for (int isou = 0; isou < 6; isou++)
917  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
918 }
919 
920 /*----------------------------------------------------------------------------*/
941 /*----------------------------------------------------------------------------*/
942 
943 inline static void
944 cs_i_conv_flux(const int iconvp,
945  const cs_real_t thetap,
946  const int imasac,
947  const cs_real_t pi,
948  const cs_real_t pj,
949  const cs_real_t pifri,
950  const cs_real_t pifrj,
951  const cs_real_t pjfri,
952  const cs_real_t pjfrj,
953  const cs_real_t i_massflux,
954  const cs_real_t xcppi,
955  const cs_real_t xcppj,
956  cs_real_2_t fluxij)
957 {
958  cs_real_t flui, fluj;
959 
960  flui = 0.5*(i_massflux + fabs(i_massflux));
961  fluj = 0.5*(i_massflux - fabs(i_massflux));
962 
963  fluxij[0] += iconvp*xcppi*(thetap*(flui*pifri + fluj*pjfri) - imasac*i_massflux*pi);
964  fluxij[1] += iconvp*xcppj*(thetap*(flui*pifrj + fluj*pjfrj) - imasac*i_massflux*pj);
965 }
966 
967 /*----------------------------------------------------------------------------*/
985 /*----------------------------------------------------------------------------*/
986 
987 inline static void
988 cs_i_conv_flux_vector(const int iconvp,
989  const cs_real_t thetap,
990  const int imasac,
991  const cs_real_3_t pi,
992  const cs_real_3_t pj,
993  const cs_real_3_t pifri,
994  const cs_real_3_t pifrj,
995  const cs_real_3_t pjfri,
996  const cs_real_3_t pjfrj,
997  const cs_real_t i_massflux,
998  cs_real_t fluxi[3],
999  cs_real_t fluxj[3])
1000 {
1001  cs_real_t flui, fluj;
1002 
1003  flui = 0.5*(i_massflux + fabs(i_massflux));
1004  fluj = 0.5*(i_massflux - fabs(i_massflux));
1005 
1006  for (int isou = 0; isou < 3; isou++) {
1007 
1008  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1009  - imasac*i_massflux*pi[isou]);
1010  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1011  - imasac*i_massflux*pj[isou]);
1012  }
1013 }
1014 
1015 /*----------------------------------------------------------------------------*/
1033 /*----------------------------------------------------------------------------*/
1034 
1035 inline static void
1036 cs_i_conv_flux_tensor(const int iconvp,
1037  const cs_real_t thetap,
1038  const int imasac,
1039  const cs_real_6_t pi,
1040  const cs_real_6_t pj,
1041  const cs_real_6_t pifri,
1042  const cs_real_6_t pifrj,
1043  const cs_real_6_t pjfri,
1044  const cs_real_6_t pjfrj,
1045  const cs_real_t i_massflux,
1046  cs_real_t fluxi[6],
1047  cs_real_t fluxj[6])
1048 {
1049  cs_real_t flui, fluj;
1050 
1051  flui = 0.5*(i_massflux + fabs(i_massflux));
1052  fluj = 0.5*(i_massflux - fabs(i_massflux));
1053 
1054  for (int isou = 0; isou < 6; isou++) {
1055  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1056  - imasac*i_massflux*pi[isou]);
1057  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1058  - imasac*i_massflux*pj[isou]);
1059  }
1060 }
1061 
1062 /*----------------------------------------------------------------------------*/
1075 /*----------------------------------------------------------------------------*/
1076 
1077 inline static void
1078 cs_i_diff_flux(const int idiffp,
1079  const cs_real_t thetap,
1080  const cs_real_t pip,
1081  const cs_real_t pjp,
1082  const cs_real_t pipr,
1083  const cs_real_t pjpr,
1084  const cs_real_t i_visc,
1085  cs_real_2_t fluxij)
1086 {
1087  fluxij[0] += idiffp*thetap*i_visc*(pipr -pjp);
1088  fluxij[1] += idiffp*thetap*i_visc*(pip -pjpr);
1089 }
1090 
1091 /*----------------------------------------------------------------------------*/
1105 /*----------------------------------------------------------------------------*/
1106 
1107 inline static void
1108 cs_i_diff_flux_vector(const int idiffp,
1109  const cs_real_t thetap,
1110  const cs_real_3_t pip,
1111  const cs_real_3_t pjp,
1112  const cs_real_3_t pipr,
1113  const cs_real_3_t pjpr,
1114  const cs_real_t i_visc,
1115  cs_real_t fluxi[3],
1116  cs_real_t fluxj[3])
1117 {
1118  for (int isou = 0; isou < 3; isou++) {
1119  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1120  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1121  }
1122 }
1123 
1124 /*----------------------------------------------------------------------------*/
1138 /*----------------------------------------------------------------------------*/
1139 
1140 inline static void
1141 cs_i_diff_flux_tensor(const int idiffp,
1142  const cs_real_t thetap,
1143  const cs_real_6_t pip,
1144  const cs_real_6_t pjp,
1145  const cs_real_6_t pipr,
1146  const cs_real_6_t pjpr,
1147  const cs_real_t i_visc,
1148  cs_real_t fluxi[6],
1149  cs_real_t fluxj[6])
1150 {
1151  for (int isou = 0; isou < 6; isou++) {
1152  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1153  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1154  }
1155 }
1156 
1157 /*----------------------------------------------------------------------------*/
1181 /*----------------------------------------------------------------------------*/
1182 
1183 inline static void
1184 cs_i_cd_steady_upwind(const int ircflp,
1185  const cs_real_t relaxp,
1186  const cs_real_3_t diipf,
1187  const cs_real_3_t djjpf,
1188  const cs_real_3_t gradi,
1189  const cs_real_3_t gradj,
1190  const cs_real_t pi,
1191  const cs_real_t pj,
1192  const cs_real_t pia,
1193  const cs_real_t pja,
1194  cs_real_t *pifri,
1195  cs_real_t *pifrj,
1196  cs_real_t *pjfri,
1197  cs_real_t *pjfrj,
1198  cs_real_t *pip,
1199  cs_real_t *pjp,
1200  cs_real_t *pipr,
1201  cs_real_t *pjpr)
1202 {
1203  cs_real_t pir, pjr;
1204  cs_real_t recoi, recoj;
1205 
1206  cs_i_compute_quantities(ircflp,
1207  diipf,
1208  djjpf,
1209  gradi,
1210  gradj,
1211  pi,
1212  pj,
1213  &recoi,
1214  &recoj,
1215  pip,
1216  pjp);
1217 
1218  cs_i_relax_c_val(relaxp,
1219  pia,
1220  pja,
1221  recoi,
1222  recoj,
1223  pi,
1224  pj,
1225  &pir,
1226  &pjr,
1227  pipr,
1228  pjpr);
1229 
1230  cs_upwind_f_val(pi,
1231  pifrj);
1232  cs_upwind_f_val(pir,
1233  pifri);
1234  cs_upwind_f_val(pj,
1235  pjfri);
1236  cs_upwind_f_val(pjr,
1237  pjfrj);
1238 }
1239 
1240 /*----------------------------------------------------------------------------*/
1264 /*----------------------------------------------------------------------------*/
1265 
1266 inline static void
1268  const cs_real_t relaxp,
1269  const cs_real_3_t diipf,
1270  const cs_real_3_t djjpf,
1271  const cs_real_33_t gradi,
1272  const cs_real_33_t gradj,
1273  const cs_real_3_t pi,
1274  const cs_real_3_t pj,
1275  const cs_real_3_t pia,
1276  const cs_real_3_t pja,
1277  cs_real_t pifri[3],
1278  cs_real_t pifrj[3],
1279  cs_real_t pjfri[3],
1280  cs_real_t pjfrj[3],
1281  cs_real_t pip[3],
1282  cs_real_t pjp[3],
1283  cs_real_t pipr[3],
1284  cs_real_t pjpr[3])
1285 {
1286  cs_real_3_t pir, pjr;
1287  cs_real_3_t recoi, recoj;
1288 
1290  diipf,
1291  djjpf,
1292  gradi,
1293  gradj,
1294  pi,
1295  pj,
1296  recoi,
1297  recoj,
1298  pip,
1299  pjp);
1300 
1301  cs_i_relax_c_val_vector(relaxp,
1302  pia,
1303  pja,
1304  recoi,
1305  recoj,
1306  pi,
1307  pj,
1308  pir,
1309  pjr,
1310  pipr,
1311  pjpr);
1312 
1314  pifrj);
1316  pifri);
1318  pjfri);
1320  pjfrj);
1321 
1322 }
1323 
1324 /*----------------------------------------------------------------------------*/
1348 /*----------------------------------------------------------------------------*/
1349 
1350 inline static void
1352  const cs_real_t relaxp,
1353  const cs_real_3_t diipf,
1354  const cs_real_3_t djjpf,
1355  const cs_real_63_t gradi,
1356  const cs_real_63_t gradj,
1357  const cs_real_6_t pi,
1358  const cs_real_6_t pj,
1359  const cs_real_6_t pia,
1360  const cs_real_6_t pja,
1361  cs_real_t pifri[6],
1362  cs_real_t pifrj[6],
1363  cs_real_t pjfri[6],
1364  cs_real_t pjfrj[6],
1365  cs_real_t pip[6],
1366  cs_real_t pjp[6],
1367  cs_real_t pipr[6],
1368  cs_real_t pjpr[6])
1369 {
1370  cs_real_6_t pir, pjr;
1371  cs_real_6_t recoi, recoj;
1372 
1374  diipf,
1375  djjpf,
1376  gradi,
1377  gradj,
1378  pi,
1379  pj,
1380  recoi,
1381  recoj,
1382  pip,
1383  pjp);
1384 
1385  cs_i_relax_c_val_tensor(relaxp,
1386  pia,
1387  pja,
1388  recoi,
1389  recoj,
1390  pi,
1391  pj,
1392  pir,
1393  pjr,
1394  pipr,
1395  pjpr);
1396 
1398  pifrj);
1400  pifri);
1402  pjfri);
1404  pjfrj);
1405 }
1406 
1407 /*----------------------------------------------------------------------------*/
1424 /*----------------------------------------------------------------------------*/
1425 
1426 inline static void
1427 cs_i_cd_unsteady_upwind(const int ircflp,
1428  const cs_real_3_t diipf,
1429  const cs_real_3_t djjpf,
1430  const cs_real_3_t gradi,
1431  const cs_real_3_t gradj,
1432  const cs_real_t pi,
1433  const cs_real_t pj,
1434  cs_real_t *pif,
1435  cs_real_t *pjf,
1436  cs_real_t *pip,
1437  cs_real_t *pjp)
1438 {
1439  cs_real_t recoi, recoj;
1440 
1441  cs_i_compute_quantities(ircflp,
1442  diipf,
1443  djjpf,
1444  gradi,
1445  gradj,
1446  pi,
1447  pj,
1448  &recoi,
1449  &recoj,
1450  pip,
1451  pjp);
1452 
1453  cs_upwind_f_val(pi, pif);
1454  cs_upwind_f_val(pj, pjf);
1455 }
1456 
1457 /*----------------------------------------------------------------------------*/
1474 /*----------------------------------------------------------------------------*/
1475 
1476 inline static void
1478  const cs_real_3_t diipf,
1479  const cs_real_3_t djjpf,
1480  const cs_real_33_t gradi,
1481  const cs_real_33_t gradj,
1482  const cs_real_3_t pi,
1483  const cs_real_3_t pj,
1484  cs_real_t pif[3],
1485  cs_real_t pjf[3],
1486  cs_real_t pip[3],
1487  cs_real_t pjp[3])
1488 {
1489  cs_real_3_t recoi, recoj;
1490 
1492  diipf,
1493  djjpf,
1494  gradi,
1495  gradj,
1496  pi,
1497  pj,
1498  recoi,
1499  recoj,
1500  pip,
1501  pjp);
1502 
1503  cs_upwind_f_val_vector(pi, pif);
1504  cs_upwind_f_val_vector(pj, pjf);
1505 
1506 }
1507 
1508 /*----------------------------------------------------------------------------*/
1525 /*----------------------------------------------------------------------------*/
1526 
1527 inline static void
1529  const cs_real_3_t diipf,
1530  const cs_real_3_t djjpf,
1531  const cs_real_63_t gradi,
1532  const cs_real_63_t gradj,
1533  const cs_real_6_t pi,
1534  const cs_real_6_t pj,
1535  cs_real_t pif[6],
1536  cs_real_t pjf[6],
1537  cs_real_t pip[6],
1538  cs_real_t pjp[6])
1539 {
1540  cs_real_6_t recoi, recoj;
1541 
1543  diipf,
1544  djjpf,
1545  gradi,
1546  gradj,
1547  pi,
1548  pj,
1549  recoi,
1550  recoj,
1551  pip,
1552  pjp);
1553 
1554  cs_upwind_f_val_tensor(pi, pif);
1555  cs_upwind_f_val_tensor(pj, pjf);
1556 
1557 }
1558 
1559 /*----------------------------------------------------------------------------*/
1592 /*----------------------------------------------------------------------------*/
1593 
1594 inline static void
1595 cs_i_cd_steady(const int ircflp,
1596  const int ischcp,
1597  const double relaxp,
1598  const double blencp,
1599  const cs_real_t weight,
1600  const cs_real_3_t cell_ceni,
1601  const cs_real_3_t cell_cenj,
1602  const cs_real_3_t i_face_cog,
1603  const cs_real_3_t diipf,
1604  const cs_real_3_t djjpf,
1605  const cs_real_3_t gradi,
1606  const cs_real_3_t gradj,
1607  const cs_real_3_t gradupi,
1608  const cs_real_3_t gradupj,
1609  const cs_real_t pi,
1610  const cs_real_t pj,
1611  const cs_real_t pia,
1612  const cs_real_t pja,
1613  cs_real_t *pifri,
1614  cs_real_t *pifrj,
1615  cs_real_t *pjfri,
1616  cs_real_t *pjfrj,
1617  cs_real_t *pip,
1618  cs_real_t *pjp,
1619  cs_real_t *pipr,
1620  cs_real_t *pjpr)
1621 {
1622  cs_real_t pir, pjr;
1623  cs_real_t recoi, recoj;
1624 
1625  cs_i_compute_quantities(ircflp,
1626  diipf,
1627  djjpf,
1628  gradi,
1629  gradj,
1630  pi,
1631  pj,
1632  &recoi,
1633  &recoj,
1634  pip,
1635  pjp);
1636 
1637  cs_i_relax_c_val(relaxp,
1638  pia,
1639  pja,
1640  recoi,
1641  recoj,
1642  pi,
1643  pj,
1644  &pir,
1645  &pjr,
1646  pipr,
1647  pjpr);
1648 
1649  if (ischcp == 1) {
1650 
1651  /* Centered
1652  --------*/
1653 
1654  cs_centered_f_val(weight,
1655  *pip,
1656  *pjpr,
1657  pifrj);
1658  cs_centered_f_val(weight,
1659  *pipr,
1660  *pjp,
1661  pifri);
1662  cs_centered_f_val(weight,
1663  *pipr,
1664  *pjp,
1665  pjfri);
1666  cs_centered_f_val(weight,
1667  *pip,
1668  *pjpr,
1669  pjfrj);
1670 
1671  } else if (ischcp == 0) {
1672 
1673  /* Original SOLU
1674  --------------*/
1675 
1676  cs_solu_f_val(cell_ceni,
1677  i_face_cog,
1678  gradi,
1679  pi,
1680  pifrj);
1681  cs_solu_f_val(cell_ceni,
1682  i_face_cog,
1683  gradi,
1684  pir,
1685  pifri);
1686  cs_solu_f_val(cell_cenj,
1687  i_face_cog,
1688  gradj,
1689  pj,
1690  pjfri);
1691  cs_solu_f_val(cell_cenj,
1692  i_face_cog,
1693  gradj,
1694  pjr,
1695  pjfrj);
1696 
1697  } else {
1698 
1699  /* SOLU
1700  ----*/
1701 
1702  cs_solu_f_val(cell_ceni,
1703  i_face_cog,
1704  gradupi,
1705  pi,
1706  pifrj);
1707  cs_solu_f_val(cell_ceni,
1708  i_face_cog,
1709  gradupi,
1710  pir,
1711  pifri);
1712  cs_solu_f_val(cell_cenj,
1713  i_face_cog,
1714  gradupj,
1715  pj,
1716  pjfri);
1717  cs_solu_f_val(cell_cenj,
1718  i_face_cog,
1719  gradupj,
1720  pjr,
1721  pjfrj);
1722 
1723  }
1724 
1725  /* Blending
1726  --------*/
1727 
1728  cs_blend_f_val(blencp,
1729  pi,
1730  pifrj);
1731  cs_blend_f_val(blencp,
1732  pir,
1733  pifri);
1734  cs_blend_f_val(blencp,
1735  pj,
1736  pjfri);
1737  cs_blend_f_val(blencp,
1738  pjr,
1739  pjfrj);
1740 }
1741 
1742 /*----------------------------------------------------------------------------*/
1773 /*----------------------------------------------------------------------------*/
1774 
1775 inline static void
1776 cs_i_cd_steady_vector(const int ircflp,
1777  const int ischcp,
1778  const double relaxp,
1779  const double blencp,
1780  const cs_real_t weight,
1781  const cs_real_3_t cell_ceni,
1782  const cs_real_3_t cell_cenj,
1783  const cs_real_3_t i_face_cog,
1784  const cs_real_3_t diipf,
1785  const cs_real_3_t djjpf,
1786  const cs_real_33_t gradi,
1787  const cs_real_33_t gradj,
1788  const cs_real_3_t pi,
1789  const cs_real_3_t pj,
1790  const cs_real_3_t pia,
1791  const cs_real_3_t pja,
1792  cs_real_t pifri[3],
1793  cs_real_t pifrj[3],
1794  cs_real_t pjfri[3],
1795  cs_real_t pjfrj[3],
1796  cs_real_t pip[3],
1797  cs_real_t pjp[3],
1798  cs_real_t pipr[3],
1799  cs_real_t pjpr[3])
1800 {
1801  cs_real_3_t pir, pjr;
1802  cs_real_3_t recoi, recoj;
1803 
1805  diipf,
1806  djjpf,
1807  gradi,
1808  gradj,
1809  pi,
1810  pj,
1811  recoi,
1812  recoj,
1813  pip,
1814  pjp);
1815 
1816  cs_i_relax_c_val_vector(relaxp,
1817  pia,
1818  pja,
1819  recoi,
1820  recoj,
1821  pi,
1822  pj,
1823  pir,
1824  pjr,
1825  pipr,
1826  pjpr);
1827 
1828  if (ischcp == 1) {
1829 
1830  /* Centered
1831  --------*/
1832 
1833  cs_centered_f_val_vector(weight,
1834  pip,
1835  pjpr,
1836  pifrj);
1837  cs_centered_f_val_vector(weight,
1838  pipr,
1839  pjp,
1840  pifri);
1841  cs_centered_f_val_vector(weight,
1842  pipr,
1843  pjp,
1844  pjfri);
1845  cs_centered_f_val_vector(weight,
1846  pip,
1847  pjpr,
1848  pjfrj);
1849 
1850  } else {
1851 
1852  /* Second order
1853  ------------*/
1854 
1855  cs_solu_f_val_vector(cell_ceni,
1856  i_face_cog,
1857  gradi,
1858  pi,
1859  pifrj);
1860  cs_solu_f_val_vector(cell_ceni,
1861  i_face_cog,
1862  gradi,
1863  pir,
1864  pifri);
1865  cs_solu_f_val_vector(cell_cenj,
1866  i_face_cog,
1867  gradj,
1868  pj,
1869  pjfri);
1870  cs_solu_f_val_vector(cell_cenj,
1871  i_face_cog,
1872  gradj,
1873  pjr,
1874  pjfrj);
1875 
1876  }
1877 
1878  /* Blending
1879  --------*/
1880  cs_blend_f_val_vector(blencp,
1881  pi,
1882  pifrj);
1883  cs_blend_f_val_vector(blencp,
1884  pir,
1885  pifri);
1886  cs_blend_f_val_vector(blencp,
1887  pj,
1888  pjfri);
1889  cs_blend_f_val_vector(blencp,
1890  pjr,
1891  pjfrj);
1892 
1893 }
1894 
1895 /*----------------------------------------------------------------------------*/
1926 /*----------------------------------------------------------------------------*/
1927 
1928 inline static void
1929 cs_i_cd_steady_tensor(const int ircflp,
1930  const int ischcp,
1931  const double relaxp,
1932  const double blencp,
1933  const cs_real_t weight,
1934  const cs_real_3_t cell_ceni,
1935  const cs_real_3_t cell_cenj,
1936  const cs_real_3_t i_face_cog,
1937  const cs_real_3_t diipf,
1938  const cs_real_3_t djjpf,
1939  const cs_real_63_t gradi,
1940  const cs_real_63_t gradj,
1941  const cs_real_6_t pi,
1942  const cs_real_6_t pj,
1943  const cs_real_6_t pia,
1944  const cs_real_6_t pja,
1945  cs_real_t pifri[6],
1946  cs_real_t pifrj[6],
1947  cs_real_t pjfri[6],
1948  cs_real_t pjfrj[6],
1949  cs_real_t pip[6],
1950  cs_real_t pjp[6],
1951  cs_real_t pipr[6],
1952  cs_real_t pjpr[6])
1953 
1954 {
1955  cs_real_6_t pir, pjr;
1956  cs_real_6_t recoi, recoj;
1957 
1959  diipf,
1960  djjpf,
1961  gradi,
1962  gradj,
1963  pi,
1964  pj,
1965  recoi,
1966  recoj,
1967  pip,
1968  pjp);
1969 
1970  cs_i_relax_c_val_tensor(relaxp,
1971  pia,
1972  pja,
1973  recoi,
1974  recoj,
1975  pi,
1976  pj,
1977  pir,
1978  pjr,
1979  pipr,
1980  pjpr);
1981 
1982  if (ischcp == 1) {
1983 
1984  /* Centered
1985  --------*/
1986 
1987  cs_centered_f_val_tensor(weight,
1988  pip,
1989  pjpr,
1990  pifrj);
1991  cs_centered_f_val_tensor(weight,
1992  pipr,
1993  pjp,
1994  pifri);
1995  cs_centered_f_val_tensor(weight,
1996  pipr,
1997  pjp,
1998  pjfri);
1999  cs_centered_f_val_tensor(weight,
2000  pip,
2001  pjpr,
2002  pjfrj);
2003 
2004  } else {
2005 
2006  /* Second order
2007  ------------*/
2008 
2009  cs_solu_f_val_tensor(cell_ceni,
2010  i_face_cog,
2011  gradi,
2012  pi,
2013  pifrj);
2014  cs_solu_f_val_tensor(cell_ceni,
2015  i_face_cog,
2016  gradi,
2017  pir,
2018  pifri);
2019  cs_solu_f_val_tensor(cell_cenj,
2020  i_face_cog,
2021  gradj,
2022  pj,
2023  pjfri);
2024  cs_solu_f_val_tensor(cell_cenj,
2025  i_face_cog,
2026  gradj,
2027  pjr,
2028  pjfrj);
2029 
2030  }
2031 
2032  /* Blending
2033  --------*/
2034 
2035  cs_blend_f_val_tensor(blencp,
2036  pi,
2037  pifrj);
2038  cs_blend_f_val_tensor(blencp,
2039  pir,
2040  pifri);
2041  cs_blend_f_val_tensor(blencp,
2042  pj,
2043  pjfri);
2044  cs_blend_f_val_tensor(blencp,
2045  pjr,
2046  pjfrj);
2047 
2048 }
2049 
2050 /*----------------------------------------------------------------------------*/
2080 /*----------------------------------------------------------------------------*/
2081 
2082 inline static void
2083 cs_i_cd_unsteady(const int ircflp,
2084  const int ischcp,
2085  const double blencp,
2086  const cs_real_t weight,
2087  const cs_real_3_t cell_ceni,
2088  const cs_real_3_t cell_cenj,
2089  const cs_real_3_t i_face_cog,
2090  const cs_real_t hybrid_blend_i,
2091  const cs_real_t hybrid_blend_j,
2092  const cs_real_3_t diipf,
2093  const cs_real_3_t djjpf,
2094  const cs_real_3_t gradi,
2095  const cs_real_3_t gradj,
2096  const cs_real_3_t gradupi,
2097  const cs_real_3_t gradupj,
2098  const cs_real_t pi,
2099  const cs_real_t pj,
2100  cs_real_t *pif,
2101  cs_real_t *pjf,
2102  cs_real_t *pip,
2103  cs_real_t *pjp)
2104 {
2105  cs_real_t recoi, recoj;
2106 
2107  cs_i_compute_quantities(ircflp,
2108  diipf,
2109  djjpf,
2110  gradi,
2111  gradj,
2112  pi,
2113  pj,
2114  &recoi,
2115  &recoj,
2116  pip,
2117  pjp);
2118 
2119 
2120  if (ischcp == 1) {
2121 
2122  /* Centered
2123  --------*/
2124 
2125  cs_centered_f_val(weight,
2126  *pip,
2127  *pjp,
2128  pif);
2129  cs_centered_f_val(weight,
2130  *pip,
2131  *pjp,
2132  pjf);
2133 
2134  } else if (ischcp == 0) {
2135 
2136  /* Legacy SOLU
2137  -----------*/
2138 
2139  cs_solu_f_val(cell_ceni,
2140  i_face_cog,
2141  gradi,
2142  pi,
2143  pif);
2144  cs_solu_f_val(cell_cenj,
2145  i_face_cog,
2146  gradj,
2147  pj,
2148  pjf);
2149 
2150  } else if (ischcp == 3) {
2151 
2152  /* Centered
2153  --------*/
2154 
2155  cs_centered_f_val(weight,
2156  *pip,
2157  *pjp,
2158  pif);
2159  cs_centered_f_val(weight,
2160  *pip,
2161  *pjp,
2162  pjf);
2163 
2164  /* Legacy SOLU
2165  -----------*/
2166  cs_real_t pif_up, pjf_up;
2167  cs_real_t hybrid_blend_interp;
2168 
2169  cs_solu_f_val(cell_ceni,
2170  i_face_cog,
2171  gradi,
2172  pi,
2173  &pif_up);
2174  cs_solu_f_val(cell_cenj,
2175  i_face_cog,
2176  gradj,
2177  pj,
2178  &pjf_up);
2179 
2180  hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2181  *pif = hybrid_blend_interp*(*pif) + (1. - hybrid_blend_interp)*pif_up;
2182  *pjf = hybrid_blend_interp*(*pjf) + (1. - hybrid_blend_interp)*pjf_up;
2183 
2184  } else {
2185 
2186  /* SOLU
2187  ----*/
2188 
2189  cs_solu_f_val(cell_ceni,
2190  i_face_cog,
2191  gradupi,
2192  pi,
2193  pif);
2194  cs_solu_f_val(cell_cenj,
2195  i_face_cog,
2196  gradupj,
2197  pj,
2198  pjf);
2199 
2200  }
2201 
2202 
2203  /* Blending
2204  --------*/
2205 
2206  cs_blend_f_val(blencp,
2207  pi,
2208  pif);
2209  cs_blend_f_val(blencp,
2210  pj,
2211  pjf);
2212 }
2213 
2214 /*----------------------------------------------------------------------------*/
2240 /*----------------------------------------------------------------------------*/
2241 
2242 inline static void
2243 cs_i_cd_unsteady_vector(const int ircflp,
2244  const int ischcp,
2245  const double blencp,
2246  const cs_real_t weight,
2247  const cs_real_3_t cell_ceni,
2248  const cs_real_3_t cell_cenj,
2249  const cs_real_3_t i_face_cog,
2250  const cs_real_t hybrid_blend_i,
2251  const cs_real_t hybrid_blend_j,
2252  const cs_real_3_t diipf,
2253  const cs_real_3_t djjpf,
2254  const cs_real_33_t gradi,
2255  const cs_real_33_t gradj,
2256  const cs_real_3_t pi,
2257  const cs_real_3_t pj,
2258  cs_real_t pif[3],
2259  cs_real_t pjf[3],
2260  cs_real_t pip[3],
2261  cs_real_t pjp[3])
2262 
2263 {
2264  cs_real_3_t recoi, recoj;
2265 
2267  diipf,
2268  djjpf,
2269  gradi,
2270  gradj,
2271  pi,
2272  pj,
2273  recoi,
2274  recoj,
2275  pip,
2276  pjp);
2277 
2278  if (ischcp == 1) {
2279 
2280  /* Centered
2281  --------*/
2282 
2283  cs_centered_f_val_vector(weight,
2284  pip,
2285  pjp,
2286  pif);
2287  cs_centered_f_val_vector(weight,
2288  pip,
2289  pjp,
2290  pjf);
2291  } else if (ischcp ==3) {
2292 
2293  /* Centered
2294  --------*/
2295 
2296  cs_centered_f_val_vector(weight,
2297  pip,
2298  pjp,
2299  pif);
2300  cs_centered_f_val_vector(weight,
2301  pip,
2302  pjp,
2303  pjf);
2304 
2305  /* SOLU
2306  -----*/
2307  cs_real_t pif_up[3], pjf_up[3];
2308  cs_real_t hybrid_blend_interp;
2309 
2310  cs_solu_f_val_vector(cell_ceni,
2311  i_face_cog,
2312  gradi,
2313  pi,
2314  pif_up);
2315  cs_solu_f_val_vector(cell_cenj,
2316  i_face_cog,
2317  gradj,
2318  pj,
2319  pjf_up);
2320 
2321  hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2322  for (int isou = 0; isou < 3; isou++) {
2323  pif[isou] = hybrid_blend_interp *pif[isou]
2324  + (1. - hybrid_blend_interp)*pif_up[isou];
2325  pjf[isou] = hybrid_blend_interp *pjf[isou]
2326  + (1. - hybrid_blend_interp)*pjf_up[isou];
2327  }
2328  } else {
2329 
2330  /* Second order
2331  ------------*/
2332 
2333  cs_solu_f_val_vector(cell_ceni,
2334  i_face_cog,
2335  gradi,
2336  pi,
2337  pif);
2338  cs_solu_f_val_vector(cell_cenj,
2339  i_face_cog,
2340  gradj,
2341  pj,
2342  pjf);
2343 
2344  }
2345 
2346  /* Blending
2347  --------*/
2348 
2349  cs_blend_f_val_vector(blencp,
2350  pi,
2351  pif);
2352  cs_blend_f_val_vector(blencp,
2353  pj,
2354  pjf);
2355 }
2356 
2357 /*----------------------------------------------------------------------------*/
2381 /*----------------------------------------------------------------------------*/
2382 
2383 inline static void
2384 cs_i_cd_unsteady_tensor(const int ircflp,
2385  const int ischcp,
2386  const double blencp,
2387  const cs_real_t weight,
2388  const cs_real_3_t cell_ceni,
2389  const cs_real_3_t cell_cenj,
2390  const cs_real_3_t i_face_cog,
2391  const cs_real_3_t diipf,
2392  const cs_real_3_t djjpf,
2393  const cs_real_63_t gradi,
2394  const cs_real_63_t gradj,
2395  const cs_real_6_t pi,
2396  const cs_real_6_t pj,
2397  cs_real_t pif[6],
2398  cs_real_t pjf[6],
2399  cs_real_t pip[6],
2400  cs_real_t pjp[6])
2401 
2402 {
2403  cs_real_6_t recoi, recoj;
2404 
2406  diipf,
2407  djjpf,
2408  gradi,
2409  gradj,
2410  pi,
2411  pj,
2412  recoi,
2413  recoj,
2414  pip,
2415  pjp);
2416 
2417  if (ischcp == 1) {
2418 
2419  /* Centered
2420  --------*/
2421 
2422  cs_centered_f_val_tensor(weight,
2423  pip,
2424  pjp,
2425  pif);
2426  cs_centered_f_val_tensor(weight,
2427  pip,
2428  pjp,
2429  pjf);
2430 
2431  } else {
2432 
2433  /* Second order
2434  ------------*/
2435 
2436  cs_solu_f_val_tensor(cell_ceni,
2437  i_face_cog,
2438  gradi,
2439  pi,
2440  pif);
2441  cs_solu_f_val_tensor(cell_cenj,
2442  i_face_cog,
2443  gradj,
2444  pj,
2445  pjf);
2446 
2447  }
2448 
2449  /* Blending
2450  --------*/
2451 
2452  cs_blend_f_val_tensor(blencp,
2453  pi,
2454  pif);
2455  cs_blend_f_val_tensor(blencp,
2456  pj,
2457  pjf);
2458 
2459 }
2460 
2461 /*----------------------------------------------------------------------------*/
2505 /*----------------------------------------------------------------------------*/
2506 
2507 inline static void
2508 cs_i_cd_steady_slope_test(bool *upwind_switch,
2509  const int iconvp,
2510  const int ircflp,
2511  const int ischcp,
2512  const double relaxp,
2513  const double blencp,
2514  const double blend_st,
2515  const cs_real_t weight,
2516  const cs_real_t i_dist,
2517  const cs_real_t i_face_surf,
2518  const cs_real_3_t cell_ceni,
2519  const cs_real_3_t cell_cenj,
2520  const cs_real_3_t i_face_normal,
2521  const cs_real_3_t i_face_cog,
2522  const cs_real_3_t diipf,
2523  const cs_real_3_t djjpf,
2524  const cs_real_t i_massflux,
2525  const cs_real_3_t gradi,
2526  const cs_real_3_t gradj,
2527  const cs_real_3_t gradupi,
2528  const cs_real_3_t gradupj,
2529  const cs_real_3_t gradsti,
2530  const cs_real_3_t gradstj,
2531  const cs_real_t pi,
2532  const cs_real_t pj,
2533  const cs_real_t pia,
2534  const cs_real_t pja,
2535  cs_real_t *pifri,
2536  cs_real_t *pifrj,
2537  cs_real_t *pjfri,
2538  cs_real_t *pjfrj,
2539  cs_real_t *pip,
2540  cs_real_t *pjp,
2541  cs_real_t *pipr,
2542  cs_real_t *pjpr)
2543 {
2544  cs_real_t pir, pjr;
2545  cs_real_t recoi, recoj;
2546  cs_real_t distf, srfan, testij, tesqck;
2547 
2548  distf = i_dist;
2549  srfan = i_face_surf;
2550 
2551  *upwind_switch = false;
2552 
2553  cs_i_compute_quantities(ircflp,
2554  diipf,
2555  djjpf,
2556  gradi,
2557  gradj,
2558  pi,
2559  pj,
2560  &recoi,
2561  &recoj,
2562  pip,
2563  pjp);
2564 
2565  cs_i_relax_c_val(relaxp,
2566  pia,
2567  pja,
2568  recoi,
2569  recoj,
2570  pi,
2571  pj,
2572  &pir,
2573  &pjr,
2574  pipr,
2575  pjpr);
2576 
2577  /* Convection slope test is needed only when iconv >0 */
2578  if (iconvp > 0) {
2579  cs_slope_test(pi,
2580  pj,
2581  distf,
2582  srfan,
2583  i_face_normal,
2584  gradi,
2585  gradj,
2586  gradsti,
2587  gradstj,
2588  i_massflux,
2589  &testij,
2590  &tesqck);
2591 
2592  if (ischcp==1) {
2593 
2594  /* Centered
2595  --------*/
2596 
2597  cs_centered_f_val(weight,
2598  *pip,
2599  *pjpr,
2600  pifrj);
2601  cs_centered_f_val(weight,
2602  *pipr,
2603  *pjp,
2604  pifri);
2605  cs_centered_f_val(weight,
2606  *pipr,
2607  *pjp,
2608  pjfri);
2609  cs_centered_f_val(weight,
2610  *pip,
2611  *pjpr,
2612  pjfrj);
2613 
2614  } else if (ischcp == 0) {
2615 
2616  /* Second order
2617  ------------*/
2618 
2619  cs_solu_f_val(cell_ceni,
2620  i_face_cog,
2621  gradi,
2622  pi,
2623  pifrj);
2624  cs_solu_f_val(cell_ceni,
2625  i_face_cog,
2626  gradi,
2627  pir,
2628  pifri);
2629  cs_solu_f_val(cell_cenj,
2630  i_face_cog,
2631  gradj,
2632  pj,
2633  pjfri);
2634  cs_solu_f_val(cell_cenj,
2635  i_face_cog,
2636  gradj,
2637  pjr,
2638  pjfrj);
2639 
2640  } else {
2641 
2642  /* SOLU
2643  -----*/
2644 
2645  cs_solu_f_val(cell_ceni,
2646  i_face_cog,
2647  gradupi,
2648  pi,
2649  pifrj);
2650  cs_solu_f_val(cell_ceni,
2651  i_face_cog,
2652  gradupi,
2653  pir,
2654  pifri);
2655  cs_solu_f_val(cell_cenj,
2656  i_face_cog,
2657  gradupj,
2658  pj,
2659  pjfri);
2660  cs_solu_f_val(cell_cenj,
2661  i_face_cog,
2662  gradupj,
2663  pjr,
2664  pjfrj);
2665  }
2666 
2667 
2668  /* Slope test: Pourcentage of upwind
2669  ----------------------------------*/
2670 
2671  if (tesqck <= 0. || testij <= 0.) {
2672 
2673  cs_blend_f_val(blend_st,
2674  pi,
2675  pifrj);
2676  cs_blend_f_val(blend_st,
2677  pir,
2678  pifri);
2679  cs_blend_f_val(blend_st,
2680  pj,
2681  pjfri);
2682  cs_blend_f_val(blend_st,
2683  pjr,
2684  pjfrj);
2685 
2686  *upwind_switch = true;
2687 
2688  }
2689 
2690 
2691  /* Blending
2692  --------*/
2693 
2694  cs_blend_f_val(blencp,
2695  pi,
2696  pifrj);
2697  cs_blend_f_val(blencp,
2698  pir,
2699  pifri);
2700  cs_blend_f_val(blencp,
2701  pj,
2702  pjfri);
2703  cs_blend_f_val(blencp,
2704  pjr,
2705  pjfrj);
2706 
2707  /* If iconv=0 p*fr* are useless */
2708  } else {
2709  cs_upwind_f_val(pi,
2710  pifrj);
2711  cs_upwind_f_val(pir,
2712  pifri);
2713  cs_upwind_f_val(pj,
2714  pjfri);
2715  cs_upwind_f_val(pjr,
2716  pjfrj);
2717  }
2718 
2719 }
2720 
2721 /*----------------------------------------------------------------------------*/
2760 /*----------------------------------------------------------------------------*/
2761 
2762 inline static void
2764  const int iconvp,
2765  const int ircflp,
2766  const int ischcp,
2767  const double relaxp,
2768  const double blencp,
2769  const cs_real_t weight,
2770  const cs_real_t i_dist,
2771  const cs_real_t i_face_surf,
2772  const cs_real_3_t cell_ceni,
2773  const cs_real_3_t cell_cenj,
2774  const cs_real_3_t i_face_normal,
2775  const cs_real_3_t i_face_cog,
2776  const cs_real_3_t diipf,
2777  const cs_real_3_t djjpf,
2778  const cs_real_t i_massflux,
2779  const cs_real_33_t gradi,
2780  const cs_real_33_t gradj,
2781  const cs_real_33_t grdpai,
2782  const cs_real_33_t grdpaj,
2783  const cs_real_3_t pi,
2784  const cs_real_3_t pj,
2785  const cs_real_3_t pia,
2786  const cs_real_3_t pja,
2787  cs_real_t pifri[3],
2788  cs_real_t pifrj[3],
2789  cs_real_t pjfri[3],
2790  cs_real_t pjfrj[3],
2791  cs_real_t pip[3],
2792  cs_real_t pjp[3],
2793  cs_real_t pipr[3],
2794  cs_real_t pjpr[3])
2795 {
2796  cs_real_3_t pir, pjr;
2797  cs_real_3_t recoi, recoj;
2798  cs_real_t distf, srfan;
2799  cs_real_3_t testij, tesqck;
2800  int isou;
2801 
2802  distf = i_dist;
2803  srfan = i_face_surf;
2804 
2806  diipf,
2807  djjpf,
2808  gradi,
2809  gradj,
2810  pi,
2811  pj,
2812  recoi,
2813  recoj,
2814  pip,
2815  pjp);
2816 
2817  cs_i_relax_c_val_vector(relaxp,
2818  pia,
2819  pja,
2820  recoi,
2821  recoj,
2822  pi,
2823  pj,
2824  pir,
2825  pjr,
2826  pipr,
2827  pjpr);
2828 
2829  /* Convection slope test is needed only when iconv >0 */
2830  if (iconvp > 0) {
2832  pj,
2833  distf,
2834  srfan,
2835  i_face_normal,
2836  gradi,
2837  gradj,
2838  grdpai,
2839  grdpaj,
2840  i_massflux,
2841  testij,
2842  tesqck);
2843 
2844  for (isou = 0; isou < 3; isou++) {
2845  if (tesqck[isou]<=0. || testij[isou]<=0.) {
2846 
2847  /* Upwind
2848  --------*/
2849 
2850  cs_upwind_f_val(pi[isou],
2851  &pifrj[isou]);
2852  cs_upwind_f_val(pir[isou],
2853  &pifri[isou]);
2854  cs_upwind_f_val(pj[isou],
2855  &pjfri[isou]);
2856  cs_upwind_f_val(pjr[isou],
2857  &pjfrj[isou]);
2858 
2859  *upwind_switch = true;
2860 
2861  } else {
2862 
2863  if (ischcp==1) {
2864 
2865  /* Centered
2866  --------*/
2867 
2868  cs_centered_f_val(weight,
2869  pip[isou],
2870  pjpr[isou],
2871  &pifrj[isou]);
2872  cs_centered_f_val(weight,
2873  pipr[isou],
2874  pjp[isou],
2875  &pifri[isou]);
2876  cs_centered_f_val(weight,
2877  pipr[isou],
2878  pjp[isou],
2879  &pjfri[isou]);
2880  cs_centered_f_val(weight,
2881  pip[isou],
2882  pjpr[isou],
2883  &pjfrj[isou]);
2884 
2885  } else {
2886 
2887  /* Second order
2888  ------------*/
2889 
2890  cs_solu_f_val(cell_ceni,
2891  i_face_cog,
2892  gradi[isou],
2893  pi[isou],
2894  &pifrj[isou]);
2895  cs_solu_f_val(cell_ceni,
2896  i_face_cog,
2897  gradi[isou],
2898  pir[isou],
2899  &pifri[isou]);
2900  cs_solu_f_val(cell_cenj,
2901  i_face_cog,
2902  gradj[isou],
2903  pj[isou],
2904  &pjfri[isou]);
2905  cs_solu_f_val(cell_cenj,
2906  i_face_cog,
2907  gradj[isou],
2908  pjr[isou],
2909  &pjfrj[isou]);
2910 
2911  }
2912  }
2913  }
2914 
2915  /* Blending
2916  --------*/
2917  cs_blend_f_val_vector(blencp,
2918  pi,
2919  pifrj);
2920  cs_blend_f_val_vector(blencp,
2921  pir,
2922  pifri);
2923  cs_blend_f_val_vector(blencp,
2924  pj,
2925  pjfri);
2926  cs_blend_f_val_vector(blencp,
2927  pjr,
2928  pjfrj);
2929 
2930  /* If iconv=0 p*fr* are useless */
2931  } else {
2932  for (isou = 0; isou < 3; isou++) {
2933  cs_upwind_f_val(pi[isou],
2934  &pifrj[isou]);
2935  cs_upwind_f_val(pir[isou],
2936  &pifri[isou]);
2937  cs_upwind_f_val(pj[isou],
2938  &pjfri[isou]);
2939  cs_upwind_f_val(pjr[isou],
2940  &pjfrj[isou]);
2941  }
2942  }
2943 
2944 }
2945 
2946 /*----------------------------------------------------------------------------*/
2988 /*----------------------------------------------------------------------------*/
2989 
2990 inline static void
2992  const int iconvp,
2993  const int ircflp,
2994  const int ischcp,
2995  const double relaxp,
2996  const double blencp,
2997  const double blend_st,
2998  const cs_real_t weight,
2999  const cs_real_t i_dist,
3000  const cs_real_t i_face_surf,
3001  const cs_real_3_t cell_ceni,
3002  const cs_real_3_t cell_cenj,
3003  const cs_real_3_t i_face_normal,
3004  const cs_real_3_t i_face_cog,
3005  const cs_real_3_t diipf,
3006  const cs_real_3_t djjpf,
3007  const cs_real_t i_massflux,
3008  const cs_real_33_t gradi,
3009  const cs_real_33_t gradj,
3010  const cs_real_33_t grdpai,
3011  const cs_real_33_t grdpaj,
3012  const cs_real_3_t pi,
3013  const cs_real_3_t pj,
3014  const cs_real_3_t pia,
3015  const cs_real_3_t pja,
3016  cs_real_t pifri[3],
3017  cs_real_t pifrj[3],
3018  cs_real_t pjfri[3],
3019  cs_real_t pjfrj[3],
3020  cs_real_t pip[3],
3021  cs_real_t pjp[3],
3022  cs_real_t pipr[3],
3023  cs_real_t pjpr[3])
3024 {
3025  cs_real_3_t pir, pjr;
3026  cs_real_3_t recoi, recoj;
3027  cs_real_t distf, srfan;
3028  cs_real_t testij, tesqck;
3029  int isou;
3030 
3031  distf = i_dist;
3032  srfan = i_face_surf;
3033 
3035  diipf,
3036  djjpf,
3037  gradi,
3038  gradj,
3039  pi,
3040  pj,
3041  recoi,
3042  recoj,
3043  pip,
3044  pjp);
3045 
3046  cs_i_relax_c_val_vector(relaxp,
3047  pia,
3048  pja,
3049  recoi,
3050  recoj,
3051  pi,
3052  pj,
3053  pir,
3054  pjr,
3055  pipr,
3056  pjpr);
3057 
3058  /* Convection slope test is needed only when iconv >0 */
3059  if (iconvp > 0) {
3061  pj,
3062  distf,
3063  srfan,
3064  i_face_normal,
3065  gradi,
3066  gradj,
3067  grdpai,
3068  grdpaj,
3069  i_massflux,
3070  &testij,
3071  &tesqck);
3072 
3073  for (isou = 0; isou < 3; isou++) {
3074  if (ischcp==1) {
3075 
3076  /* Centered
3077  --------*/
3078 
3079  cs_centered_f_val(weight,
3080  pip[isou],
3081  pjpr[isou],
3082  &pifrj[isou]);
3083  cs_centered_f_val(weight,
3084  pipr[isou],
3085  pjp[isou],
3086  &pifri[isou]);
3087  cs_centered_f_val(weight,
3088  pipr[isou],
3089  pjp[isou],
3090  &pjfri[isou]);
3091  cs_centered_f_val(weight,
3092  pip[isou],
3093  pjpr[isou],
3094  &pjfrj[isou]);
3095 
3096  } else {
3097 
3098  /* Second order
3099  ------------*/
3100 
3101  cs_solu_f_val(cell_ceni,
3102  i_face_cog,
3103  gradi[isou],
3104  pi[isou],
3105  &pifrj[isou]);
3106  cs_solu_f_val(cell_ceni,
3107  i_face_cog,
3108  gradi[isou],
3109  pir[isou],
3110  &pifri[isou]);
3111  cs_solu_f_val(cell_cenj,
3112  i_face_cog,
3113  gradj[isou],
3114  pj[isou],
3115  &pjfri[isou]);
3116  cs_solu_f_val(cell_cenj,
3117  i_face_cog,
3118  gradj[isou],
3119  pjr[isou],
3120  &pjfrj[isou]);
3121 
3122  }
3123 
3124  }
3125 
3126  /* Slope test: Pourcentage of upwind
3127  ----------------------------------*/
3128 
3129  if (tesqck <= 0. || testij <= 0.) {
3130  cs_blend_f_val_vector(blend_st,
3131  pi,
3132  pifrj);
3133  cs_blend_f_val_vector(blend_st,
3134  pir,
3135  pifri);
3136  cs_blend_f_val_vector(blend_st,
3137  pj,
3138  pjfri);
3139  cs_blend_f_val_vector(blend_st,
3140  pjr,
3141  pjfrj);
3142 
3143  *upwind_switch = true;
3144  }
3145 
3146 
3147  /* Blending
3148  --------*/
3149  cs_blend_f_val_vector(blencp,
3150  pi,
3151  pifrj);
3152  cs_blend_f_val_vector(blencp,
3153  pir,
3154  pifri);
3155  cs_blend_f_val_vector(blencp,
3156  pj,
3157  pjfri);
3158  cs_blend_f_val_vector(blencp,
3159  pjr,
3160  pjfrj);
3161 
3162  /* If iconv=0 p*fr* are useless */
3163  } else {
3164  for (isou = 0; isou < 3; isou++) {
3165  cs_upwind_f_val(pi[isou],
3166  &pifrj[isou]);
3167  cs_upwind_f_val(pir[isou],
3168  &pifri[isou]);
3169  cs_upwind_f_val(pj[isou],
3170  &pjfri[isou]);
3171  cs_upwind_f_val(pjr[isou],
3172  &pjfrj[isou]);
3173  }
3174  }
3175 
3176 }
3177 
3178 /*----------------------------------------------------------------------------*/
3220 /*----------------------------------------------------------------------------*/
3221 
3222 inline static void
3224  const int iconvp,
3225  const int ircflp,
3226  const int ischcp,
3227  const double relaxp,
3228  const double blencp,
3229  const double blend_st,
3230  const cs_real_t weight,
3231  const cs_real_t i_dist,
3232  const cs_real_t i_face_surf,
3233  const cs_real_3_t cell_ceni,
3234  const cs_real_3_t cell_cenj,
3235  const cs_real_3_t i_face_normal,
3236  const cs_real_3_t i_face_cog,
3237  const cs_real_3_t diipf,
3238  const cs_real_3_t djjpf,
3239  const cs_real_t i_massflux,
3240  const cs_real_63_t gradi,
3241  const cs_real_63_t gradj,
3242  const cs_real_63_t grdpai,
3243  const cs_real_63_t grdpaj,
3244  const cs_real_6_t pi,
3245  const cs_real_6_t pj,
3246  const cs_real_6_t pia,
3247  const cs_real_6_t pja,
3248  cs_real_t pifri[6],
3249  cs_real_t pifrj[6],
3250  cs_real_t pjfri[6],
3251  cs_real_t pjfrj[6],
3252  cs_real_t pip[6],
3253  cs_real_t pjp[6],
3254  cs_real_t pipr[6],
3255  cs_real_t pjpr[6])
3256 {
3257  cs_real_6_t pir, pjr;
3258  cs_real_6_t recoi, recoj;
3259  cs_real_t distf, srfan;
3260  cs_real_t testij, tesqck;
3261  int isou;
3262 
3263  distf = i_dist;
3264  srfan = i_face_surf;
3265 
3267  diipf,
3268  djjpf,
3269  gradi,
3270  gradj,
3271  pi,
3272  pj,
3273  recoi,
3274  recoj,
3275  pip,
3276  pjp);
3277 
3278  cs_i_relax_c_val_tensor(relaxp,
3279  pia,
3280  pja,
3281  recoi,
3282  recoj,
3283  pi,
3284  pj,
3285  pir,
3286  pjr,
3287  pipr,
3288  pjpr);
3289 
3290  /* Convection slope test is needed only when iconv >0 */
3291  if (iconvp > 0) {
3293  pj,
3294  distf,
3295  srfan,
3296  i_face_normal,
3297  gradi,
3298  gradj,
3299  grdpai,
3300  grdpaj,
3301  i_massflux,
3302  &testij,
3303  &tesqck);
3304 
3305  for (isou = 0; isou < 6; isou++) {
3306  if (ischcp==1) {
3307 
3308  /* Centered
3309  --------*/
3310 
3311  cs_centered_f_val(weight,
3312  pip[isou],
3313  pjpr[isou],
3314  &pifrj[isou]);
3315  cs_centered_f_val(weight,
3316  pipr[isou],
3317  pjp[isou],
3318  &pifri[isou]);
3319  cs_centered_f_val(weight,
3320  pipr[isou],
3321  pjp[isou],
3322  &pjfri[isou]);
3323  cs_centered_f_val(weight,
3324  pip[isou],
3325  pjpr[isou],
3326  &pjfrj[isou]);
3327 
3328  } else {
3329 
3330  /* Second order
3331  ------------*/
3332 
3333  cs_solu_f_val(cell_ceni,
3334  i_face_cog,
3335  gradi[isou],
3336  pi[isou],
3337  &pifrj[isou]);
3338  cs_solu_f_val(cell_ceni,
3339  i_face_cog,
3340  gradi[isou],
3341  pir[isou],
3342  &pifri[isou]);
3343  cs_solu_f_val(cell_cenj,
3344  i_face_cog,
3345  gradj[isou],
3346  pj[isou],
3347  &pjfri[isou]);
3348  cs_solu_f_val(cell_cenj,
3349  i_face_cog,
3350  gradj[isou],
3351  pjr[isou],
3352  &pjfrj[isou]);
3353 
3354  }
3355 
3356  }
3357 
3358  /* Slope test: Pourcentage of upwind
3359  ----------------------------------*/
3360 
3361  if (tesqck <= 0. || testij <= 0.) {
3362 
3363  cs_blend_f_val_tensor(blend_st,
3364  pi,
3365  pifrj);
3366  cs_blend_f_val_tensor(blend_st,
3367  pir,
3368  pifri);
3369  cs_blend_f_val_tensor(blend_st,
3370  pj,
3371  pjfri);
3372  cs_blend_f_val_tensor(blend_st,
3373  pjr,
3374  pjfrj);
3375 
3376  *upwind_switch = true;
3377 
3378  }
3379 
3380 
3381  /* Blending
3382  --------*/
3383 
3384  cs_blend_f_val_tensor(blencp,
3385  pi,
3386  pifrj);
3387  cs_blend_f_val_tensor(blencp,
3388  pir,
3389  pifri);
3390  cs_blend_f_val_tensor(blencp,
3391  pj,
3392  pjfri);
3393  cs_blend_f_val_tensor(blencp,
3394  pjr,
3395  pjfrj);
3396 
3397  /* If iconv=0 p*fr* are useless */
3398  } else {
3399  for (isou = 0; isou < 6; isou++) {
3400  cs_upwind_f_val(pi[isou],
3401  &pifrj[isou]);
3402  cs_upwind_f_val(pir[isou],
3403  &pifri[isou]);
3404  cs_upwind_f_val(pj[isou],
3405  &pjfri[isou]);
3406  cs_upwind_f_val(pjr[isou],
3407  &pjfrj[isou]);
3408  }
3409  }
3410 
3411 }
3412 
3413 /*----------------------------------------------------------------------------*/
3450 /*----------------------------------------------------------------------------*/
3451 
3452 inline static void
3453 cs_i_cd_unsteady_slope_test(bool *upwind_switch,
3454  const int iconvp,
3455  const int ircflp,
3456  const int ischcp,
3457  const double blencp,
3458  const double blend_st,
3459  const cs_real_t weight,
3460  const cs_real_t i_dist,
3461  const cs_real_t i_face_surf,
3462  const cs_real_3_t cell_ceni,
3463  const cs_real_3_t cell_cenj,
3464  const cs_real_3_t i_face_normal,
3465  const cs_real_3_t i_face_cog,
3466  const cs_real_3_t diipf,
3467  const cs_real_3_t djjpf,
3468  const cs_real_t i_massflux,
3469  const cs_real_3_t gradi,
3470  const cs_real_3_t gradj,
3471  const cs_real_3_t gradupi,
3472  const cs_real_3_t gradupj,
3473  const cs_real_3_t gradsti,
3474  const cs_real_3_t gradstj,
3475  const cs_real_t pi,
3476  const cs_real_t pj,
3477  cs_real_t *pif,
3478  cs_real_t *pjf,
3479  cs_real_t *pip,
3480  cs_real_t *pjp)
3481 {
3482  CS_UNUSED(blend_st);
3483 
3484  cs_real_t recoi, recoj;
3485  cs_real_t distf, srfan, testij, tesqck;
3486 
3487  distf = i_dist;
3488  srfan = i_face_surf;
3489 
3490  *upwind_switch = false;
3491 
3492  cs_i_compute_quantities(ircflp,
3493  diipf,
3494  djjpf,
3495  gradi,
3496  gradj,
3497  pi,
3498  pj,
3499  &recoi,
3500  &recoj,
3501  pip,
3502  pjp);
3503 
3504  /* Convection slope test is needed only when iconv >0 */
3505  if (iconvp > 0) {
3506  cs_slope_test(pi,
3507  pj,
3508  distf,
3509  srfan,
3510  i_face_normal,
3511  gradi,
3512  gradj,
3513  gradsti,
3514  gradstj,
3515  i_massflux,
3516  &testij,
3517  &tesqck);
3518 
3519  if (ischcp==1) {
3520 
3521  /* Centered
3522  --------*/
3523 
3524  cs_centered_f_val(weight,
3525  *pip,
3526  *pjp,
3527  pif);
3528  cs_centered_f_val(weight,
3529  *pip,
3530  *pjp,
3531  pjf);
3532 
3533  } else if (ischcp == 0) {
3534 
3535  /* Original SOLU
3536  --------------*/
3537 
3538  cs_solu_f_val(cell_ceni,
3539  i_face_cog,
3540  gradi,
3541  pi,
3542  pif);
3543  cs_solu_f_val(cell_cenj,
3544  i_face_cog,
3545  gradj,
3546  pj,
3547  pjf);
3548 
3549  } else {
3550 
3551  /* SOLU
3552  -----*/
3553 
3554  cs_solu_f_val(cell_ceni,
3555  i_face_cog,
3556  gradupi,
3557  pi,
3558  pif);
3559  cs_solu_f_val(cell_cenj,
3560  i_face_cog,
3561  gradupj,
3562  pj,
3563  pjf);
3564 
3565  }
3566 
3567  /* Slope test: Pourcentage of upwind
3568  ----------------------------------*/
3569 
3570  if (tesqck<=0. || testij<=0.) {
3571 
3572  cs_blend_f_val(blend_st,
3573  pi,
3574  pif);
3575  cs_blend_f_val(blend_st,
3576  pj,
3577  pjf);
3578 
3579  *upwind_switch = true;
3580 
3581  }
3582 
3583  /* Blending
3584  --------*/
3585 
3586  cs_blend_f_val(blencp,
3587  pi,
3588  pif);
3589  cs_blend_f_val(blencp,
3590  pj,
3591  pjf);
3592 
3593  /* If iconv=0 p*f are useless */
3594  } else {
3595  cs_upwind_f_val(pi,
3596  pif);
3597  cs_upwind_f_val(pj,
3598  pjf);
3599  }
3600 
3601 }
3602 
3603 /*----------------------------------------------------------------------------*/
3635 /*----------------------------------------------------------------------------*/
3636 
3637 inline static void
3639  const int iconvp,
3640  const int ircflp,
3641  const int ischcp,
3642  const double blencp,
3643  const cs_real_t weight,
3644  const cs_real_t i_dist,
3645  const cs_real_t i_face_surf,
3646  const cs_real_3_t cell_ceni,
3647  const cs_real_3_t cell_cenj,
3648  const cs_real_3_t i_face_normal,
3649  const cs_real_3_t i_face_cog,
3650  const cs_real_3_t diipf,
3651  const cs_real_3_t djjpf,
3652  const cs_real_t i_massflux,
3653  const cs_real_33_t gradi,
3654  const cs_real_33_t gradj,
3655  const cs_real_33_t grdpai,
3656  const cs_real_33_t grdpaj,
3657  const cs_real_3_t pi,
3658  const cs_real_3_t pj,
3659  cs_real_t pif[3],
3660  cs_real_t pjf[3],
3661  cs_real_t pip[3],
3662  cs_real_t pjp[3])
3663 {
3664  cs_real_3_t recoi, recoj;
3665  cs_real_t distf, srfan;
3666  cs_real_3_t testij, tesqck;
3667  int isou;
3668 
3669  distf = i_dist;
3670  srfan = i_face_surf;
3671 
3673  diipf,
3674  djjpf,
3675  gradi,
3676  gradj,
3677  pi,
3678  pj,
3679  recoi,
3680  recoj,
3681  pip,
3682  pjp);
3683 
3684  /* Convection slope test is needed only when iconv >0 */
3685  if (iconvp > 0) {
3687  pj,
3688  distf,
3689  srfan,
3690  i_face_normal,
3691  gradi,
3692  gradj,
3693  grdpai,
3694  grdpaj,
3695  i_massflux,
3696  testij,
3697  tesqck);
3698 
3699  /* FIXME: slope test should be done for the vector and not component by
3700  * component. This is conserved for compatibility only. */
3701  for (isou = 0; isou < 3; isou++) {
3702  if (tesqck[isou]<=0. || testij[isou]<=0.) {
3703 
3704  /* Upwind
3705  --------*/
3706 
3707  cs_upwind_f_val(pi[isou],
3708  &pif[isou]);
3709  cs_upwind_f_val(pj[isou],
3710  &pjf[isou]);
3711 
3712  *upwind_switch = true;
3713 
3714  } else {
3715 
3716  if (ischcp==1) {
3717 
3718  /* Centered
3719  --------*/
3720 
3721  cs_centered_f_val(weight,
3722  pip[isou],
3723  pjp[isou],
3724  &pif[isou]);
3725  cs_centered_f_val(weight,
3726  pip[isou],
3727  pjp[isou],
3728  &pjf[isou]);
3729 
3730  } else {
3731 
3732  /* Second order
3733  ------------*/
3734 
3735  cs_solu_f_val(cell_ceni,
3736  i_face_cog,
3737  gradi[isou],
3738  pi[isou],
3739  &pif[isou]);
3740  cs_solu_f_val(cell_cenj,
3741  i_face_cog,
3742  gradj[isou],
3743  pj[isou],
3744  &pjf[isou]);
3745 
3746  }
3747  }
3748  }
3749 
3750  /* Blending
3751  --------*/
3752  cs_blend_f_val_vector(blencp,
3753  pi,
3754  pif);
3755  cs_blend_f_val_vector(blencp,
3756  pj,
3757  pjf);
3758 
3759  /* If iconv=0 p*f are useless */
3760  } else {
3761 
3762  for (isou = 0; isou < 3; isou++) {
3763  cs_upwind_f_val(pi[isou],
3764  &pif[isou]);
3765  cs_upwind_f_val(pj[isou],
3766  &pjf[isou]);
3767 
3768  }
3769  }
3770 }
3771 
3772 
3773 /*----------------------------------------------------------------------------*/
3808 /*----------------------------------------------------------------------------*/
3809 
3810 inline static void
3812  const int iconvp,
3813  const int ircflp,
3814  const int ischcp,
3815  const double blencp,
3816  const double blend_st,
3817  const cs_real_t weight,
3818  const cs_real_t i_dist,
3819  const cs_real_t i_face_surf,
3820  const cs_real_3_t cell_ceni,
3821  const cs_real_3_t cell_cenj,
3822  const cs_real_3_t i_face_normal,
3823  const cs_real_3_t i_face_cog,
3824  const cs_real_3_t diipf,
3825  const cs_real_3_t djjpf,
3826  const cs_real_t i_massflux,
3827  const cs_real_33_t gradi,
3828  const cs_real_33_t gradj,
3829  const cs_real_33_t grdpai,
3830  const cs_real_33_t grdpaj,
3831  const cs_real_3_t pi,
3832  const cs_real_3_t pj,
3833  cs_real_t pif[3],
3834  cs_real_t pjf[3],
3835  cs_real_t pip[3],
3836  cs_real_t pjp[3])
3837 {
3838  cs_real_3_t recoi, recoj;
3839  cs_real_t distf, srfan;
3840  cs_real_t testij, tesqck;
3841  int isou;
3842 
3843  distf = i_dist;
3844  srfan = i_face_surf;
3845 
3847  diipf,
3848  djjpf,
3849  gradi,
3850  gradj,
3851  pi,
3852  pj,
3853  recoi,
3854  recoj,
3855  pip,
3856  pjp);
3857 
3858  /* Convection slope test is needed only when iconv >0 */
3859  if (iconvp > 0) {
3861  pj,
3862  distf,
3863  srfan,
3864  i_face_normal,
3865  gradi,
3866  gradj,
3867  grdpai,
3868  grdpaj,
3869  i_massflux,
3870  &testij,
3871  &tesqck);
3872 
3873  for (isou = 0; isou < 3; isou++) {
3874  if (ischcp == 1) {
3875 
3876  /* Centered
3877  --------*/
3878 
3879  cs_centered_f_val(weight,
3880  pip[isou],
3881  pjp[isou],
3882  &pif[isou]);
3883  cs_centered_f_val(weight,
3884  pip[isou],
3885  pjp[isou],
3886  &pjf[isou]);
3887 
3888  } else {
3889 
3890  /* Second order
3891  ------------*/
3892 
3893  cs_solu_f_val(cell_ceni,
3894  i_face_cog,
3895  gradi[isou],
3896  pi[isou],
3897  &pif[isou]);
3898  cs_solu_f_val(cell_cenj,
3899  i_face_cog,
3900  gradj[isou],
3901  pj[isou],
3902  &pjf[isou]);
3903 
3904  }
3905 
3906  }
3907 
3908  /* Slope test: Pourcentage of upwind
3909  ----------------------------------*/
3910 
3911  if (tesqck <= 0. || testij <= 0.) {
3912 
3913  cs_blend_f_val_vector(blend_st,
3914  pi,
3915  pif);
3916  cs_blend_f_val_vector(blend_st,
3917  pj,
3918  pjf);
3919 
3920  *upwind_switch = true;
3921 
3922  }
3923 
3924 
3925  /* Blending
3926  --------*/
3927  cs_blend_f_val_vector(blencp,
3928  pi,
3929  pif);
3930  cs_blend_f_val_vector(blencp,
3931  pj,
3932  pjf);
3933 
3934  /* If iconv=0 p*f are useless */
3935  } else {
3936 
3937  for (isou = 0; isou < 3; isou++) {
3938  cs_upwind_f_val(pi[isou],
3939  &pif[isou]);
3940  cs_upwind_f_val(pj[isou],
3941  &pjf[isou]);
3942 
3943  }
3944  }
3945 }
3946 
3947 /*----------------------------------------------------------------------------*/
3982 /*----------------------------------------------------------------------------*/
3983 
3984 inline static void
3986  const int iconvp,
3987  const int ircflp,
3988  const int ischcp,
3989  const double blencp,
3990  const double blend_st,
3991  const cs_real_t weight,
3992  const cs_real_t i_dist,
3993  const cs_real_t i_face_surf,
3994  const cs_real_3_t cell_ceni,
3995  const cs_real_3_t cell_cenj,
3996  const cs_real_3_t i_face_normal,
3997  const cs_real_3_t i_face_cog,
3998  const cs_real_3_t diipf,
3999  const cs_real_3_t djjpf,
4000  const cs_real_t i_massflux,
4001  const cs_real_63_t gradi,
4002  const cs_real_63_t gradj,
4003  const cs_real_63_t grdpai,
4004  const cs_real_63_t grdpaj,
4005  const cs_real_6_t pi,
4006  const cs_real_6_t pj,
4007  cs_real_t pif[6],
4008  cs_real_t pjf[6],
4009  cs_real_t pip[6],
4010  cs_real_t pjp[6])
4011 {
4012  cs_real_6_t recoi, recoj;
4013  cs_real_t distf, srfan;
4014  cs_real_t testij, tesqck;
4015  int isou;
4016 
4017  distf = i_dist;
4018  srfan = i_face_surf;
4019 
4021  diipf,
4022  djjpf,
4023  gradi,
4024  gradj,
4025  pi,
4026  pj,
4027  recoi,
4028  recoj,
4029  pip,
4030  pjp);
4031 
4032  /* Convection slope test is needed only when iconv >0 */
4033  if (iconvp > 0) {
4035  pj,
4036  distf,
4037  srfan,
4038  i_face_normal,
4039  gradi,
4040  gradj,
4041  grdpai,
4042  grdpaj,
4043  i_massflux,
4044  &testij,
4045  &tesqck);
4046 
4047  for (isou = 0; isou < 6; isou++) {
4048 
4049  if (ischcp==1) {
4050 
4051  /* Centered
4052  --------*/
4053 
4054  cs_centered_f_val(weight,
4055  pip[isou],
4056  pjp[isou],
4057  &pif[isou]);
4058  cs_centered_f_val(weight,
4059  pip[isou],
4060  pjp[isou],
4061  &pjf[isou]);
4062 
4063  } else {
4064 
4065  /* Second order
4066  ------------*/
4067 
4068  cs_solu_f_val(cell_ceni,
4069  i_face_cog,
4070  gradi[isou],
4071  pi[isou],
4072  &pif[isou]);
4073  cs_solu_f_val(cell_cenj,
4074  i_face_cog,
4075  gradj[isou],
4076  pj[isou],
4077  &pjf[isou]);
4078  }
4079 
4080  }
4081 
4082  /* Slope test activated: poucentage of upwind */
4083  if (tesqck <= 0. || testij <= 0.) {
4084 
4085  /* Upwind
4086  --------*/
4087 
4088  cs_blend_f_val_tensor(blend_st,
4089  pi,
4090  pif);
4091  cs_blend_f_val_tensor(blend_st,
4092  pj,
4093  pjf);
4094 
4095  *upwind_switch = true;
4096  }
4097 
4098 
4099  /* Blending
4100  --------*/
4101 
4102  cs_blend_f_val_tensor(blencp,
4103  pi,
4104  pif);
4105  cs_blend_f_val_tensor(blencp,
4106  pj,
4107  pjf);
4108 
4109  /* If iconv=0 p*fr* are useless */
4110  } else {
4111 
4112  for (isou = 0; isou < 6; isou++) {
4113  cs_upwind_f_val(pi[isou],
4114  &pif[isou]);
4115  cs_upwind_f_val(pj[isou],
4116  &pjf[isou]);
4117  }
4118  }
4119 }
4120 
4121 /*----------------------------------------------------------------------------*/
4130 /*----------------------------------------------------------------------------*/
4131 
4132 inline static void
4134  const cs_real_3_t gradi,
4135  const int ircflp,
4136  cs_real_t *recoi)
4137 {
4138  *recoi = ircflp * ( gradi[0]*diipb[0]
4139  + gradi[1]*diipb[1]
4140  + gradi[2]*diipb[2]);
4141 }
4142 
4143 /*----------------------------------------------------------------------------*/
4152 /*----------------------------------------------------------------------------*/
4153 
4154 inline static void
4156  const cs_real_33_t gradi,
4157  const int ircflp,
4158  cs_real_t recoi[3])
4159 {
4160  for (int isou = 0; isou < 3; isou++) {
4161  recoi[isou] = ircflp * ( gradi[isou][0]*diipb[0]
4162  + gradi[isou][1]*diipb[1]
4163  + gradi[isou][2]*diipb[2]);
4164  }
4165 }
4166 
4167 /*----------------------------------------------------------------------------*/
4176 /*----------------------------------------------------------------------------*/
4177 
4178 inline static void
4180  const cs_real_63_t gradi,
4181  const int ircflp,
4182  cs_real_t recoi[6])
4183 {
4184  for (int isou = 0; isou < 6; isou++) {
4185  recoi[isou] = ircflp * (gradi[isou][0]*diipb[0]
4186  + gradi[isou][1]*diipb[1]
4187  + gradi[isou][2]*diipb[2]);
4188  }
4189 }
4190 
4191 /*----------------------------------------------------------------------------*/
4202 /*----------------------------------------------------------------------------*/
4203 
4204 inline static void
4205 cs_b_relax_c_val(const double relaxp,
4206  const cs_real_t pi,
4207  const cs_real_t pia,
4208  const cs_real_t recoi,
4209  cs_real_t *pir,
4210  cs_real_t *pipr)
4211 {
4212  *pir = pi/relaxp - (1.-relaxp)/relaxp*pia;
4213  *pipr = *pir + recoi;
4214 }
4215 
4216 /*----------------------------------------------------------------------------*/
4227 /*----------------------------------------------------------------------------*/
4228 
4229 inline static void
4230 cs_b_relax_c_val_vector(const double relaxp,
4231  const cs_real_3_t pi,
4232  const cs_real_3_t pia,
4233  const cs_real_3_t recoi,
4234  cs_real_t pir[3],
4235  cs_real_t pipr[3])
4236 {
4237  for (int isou = 0; isou < 3; isou++) {
4238  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4239  pipr[isou] = pir[isou] + recoi[isou];
4240  }
4241 }
4242 
4243 /*----------------------------------------------------------------------------*/
4254 /*----------------------------------------------------------------------------*/
4255 
4256 inline static void
4257 cs_b_relax_c_val_tensor(const double relaxp,
4258  const cs_real_6_t pi,
4259  const cs_real_6_t pia,
4260  const cs_real_6_t recoi,
4261  cs_real_t pir[6],
4262  cs_real_t pipr[6])
4263 {
4264  for (int isou = 0; isou < 6; isou++) {
4265  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4266  pipr[isou] = pir[isou] + recoi[isou];
4267  }
4268 }
4269 
4270 /*----------------------------------------------------------------------------*/
4294 /*----------------------------------------------------------------------------*/
4295 
4296 inline static void
4298  cs_real_t thetap,
4299  int imasac,
4300  int inc,
4301  cs_int_t bc_type,
4302  int icvfli,
4303  cs_real_t pi,
4304  cs_real_t pir,
4305  cs_real_t pipr,
4306  cs_real_t coefap,
4307  cs_real_t coefbp,
4308  cs_real_t coface,
4309  cs_real_t cofbce,
4310  cs_real_t b_massflux,
4311  cs_real_t xcpp,
4312  cs_real_t *flux)
4313 {
4314  cs_real_t flui, fluj, pfac;
4315 
4316  /* Computed convective flux */
4317 
4318  if (icvfli == 0) {
4319 
4320  /* Remove decentering for coupled faces */
4321  if (bc_type == CS_COUPLED_FD) {
4322  flui = 0.0;
4323  fluj = b_massflux;
4324  } else {
4325  flui = 0.5*(b_massflux +fabs(b_massflux));
4326  fluj = 0.5*(b_massflux -fabs(b_massflux));
4327  }
4328 
4329  pfac = inc*coefap + coefbp*pipr;
4330  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4331 
4332  /* Imposed convective flux */
4333 
4334  } else {
4335 
4336  pfac = inc*coface + cofbce*pipr;
4337  *flux += iconvp*xcpp*(-imasac*(b_massflux*pi) + thetap*(pfac));
4338 
4339  }
4340 }
4341 
4342 /*----------------------------------------------------------------------------*/
4364 /*----------------------------------------------------------------------------*/
4365 
4366 inline static void
4368  cs_real_t thetap,
4369  int imasac,
4370  int inc,
4371  cs_int_t bc_type,
4372  int icvfli,
4373  const cs_real_t pi[restrict 3],
4374  const cs_real_t pir[restrict 3],
4375  const cs_real_t pipr[restrict 3],
4376  const cs_real_t coefap[restrict 3],
4377  const cs_real_t coefbp[restrict 3][3],
4378  const cs_real_t coface[restrict 3],
4379  const cs_real_t cofbce[restrict 3][3],
4380  cs_real_t b_massflux,
4381  cs_real_t flux[restrict 3])
4382 {
4383  cs_real_t flui, fluj, pfac;
4384 
4385  /* Computed convective flux */
4386 
4387  if (icvfli == 0) {
4388 
4389  /* Remove decentering for coupled faces */
4390  if (bc_type == CS_COUPLED_FD) {
4391  flui = 0.0;
4392  fluj = b_massflux;
4393  } else {
4394  flui = 0.5*(b_massflux +fabs(b_massflux));
4395  fluj = 0.5*(b_massflux -fabs(b_massflux));
4396  }
4397  for (int isou = 0; isou < 3; isou++) {
4398  pfac = inc*coefap[isou];
4399  for (int jsou = 0; jsou < 3; jsou++) {
4400  pfac += coefbp[isou][jsou]*pipr[jsou];
4401  }
4402  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4403  - imasac*b_massflux*pi[isou]);
4404  }
4405 
4406  /* Imposed convective flux */
4407 
4408  } else {
4409 
4410  for (int isou = 0; isou < 3; isou++) {
4411  pfac = inc*coface[isou];
4412  for (int jsou = 0; jsou < 3; jsou++) {
4413  pfac += cofbce[isou][jsou]*pipr[jsou];
4414  }
4415  flux[isou] += iconvp*( thetap*pfac
4416  - imasac*b_massflux*pi[isou]);
4417  }
4418 
4419  }
4420 }
4421 
4422 /*----------------------------------------------------------------------------*/
4442 /*----------------------------------------------------------------------------*/
4443 
4444 inline static void
4445 cs_b_upwind_flux(const int iconvp,
4446  const cs_real_t thetap,
4447  const int imasac,
4448  const int inc,
4449  const int bc_type,
4450  const cs_real_t pi,
4451  const cs_real_t pir,
4452  const cs_real_t pipr,
4453  const cs_real_t coefap,
4454  const cs_real_t coefbp,
4455  const cs_real_t b_massflux,
4456  const cs_real_t xcpp,
4457  cs_real_t *flux)
4458 {
4459  cs_real_t flui, fluj, pfac;
4460 
4461  /* Remove decentering for coupled faces */
4462  if (bc_type == CS_COUPLED_FD) {
4463  flui = 0.0;
4464  fluj = b_massflux;
4465  } else {
4466  flui = 0.5*(b_massflux +fabs(b_massflux));
4467  fluj = 0.5*(b_massflux -fabs(b_massflux));
4468  }
4469 
4470  pfac = inc*coefap + coefbp*pipr;
4471  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4472 }
4473 
4474 /*----------------------------------------------------------------------------*/
4494 /*----------------------------------------------------------------------------*/
4495 
4496 inline static void
4497 cs_b_upwind_flux_vector(const int iconvp,
4498  const cs_real_t thetap,
4499  const int imasac,
4500  const int inc,
4501  const int bc_type,
4502  const cs_real_3_t pi,
4503  const cs_real_3_t pir,
4504  const cs_real_3_t pipr,
4505  const cs_real_3_t coefa,
4506  const cs_real_33_t coefb,
4507  const cs_real_t b_massflux,
4508  cs_real_t flux[3])
4509 {
4510  cs_real_t flui, fluj, pfac;
4511 
4512  /* Remove decentering for coupled faces */
4513  if (bc_type == CS_COUPLED_FD) {
4514  flui = 0.0;
4515  fluj = b_massflux;
4516  } else {
4517  flui = 0.5*(b_massflux +fabs(b_massflux));
4518  fluj = 0.5*(b_massflux -fabs(b_massflux));
4519  }
4520  for (int isou = 0; isou < 3; isou++) {
4521  pfac = inc*coefa[isou];
4522  for (int jsou = 0; jsou < 3; jsou++) {
4523  pfac += coefb[isou][jsou]*pipr[jsou];
4524  }
4525  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4526  - imasac*b_massflux*pi[isou]);
4527  }
4528 }
4529 
4530 /*----------------------------------------------------------------------------*/
4550 /*----------------------------------------------------------------------------*/
4551 
4552 inline static void
4553 cs_b_upwind_flux_tensor(const int iconvp,
4554  const cs_real_t thetap,
4555  const int imasac,
4556  const int inc,
4557  const int bc_type,
4558  const cs_real_6_t pi,
4559  const cs_real_6_t pir,
4560  const cs_real_6_t pipr,
4561  const cs_real_6_t coefa,
4562  const cs_real_66_t coefb,
4563  const cs_real_t b_massflux,
4564  cs_real_t flux[6])
4565 {
4566  cs_real_t flui, fluj, pfac;
4567 
4568  /* Remove decentering for coupled faces */
4569  if (bc_type == CS_COUPLED_FD) {
4570  flui = 0.0;
4571  fluj = b_massflux;
4572  } else {
4573  flui = 0.5*(b_massflux +fabs(b_massflux));
4574  fluj = 0.5*(b_massflux -fabs(b_massflux));
4575  }
4576  for (int isou = 0; isou < 6; isou++) {
4577  pfac = inc*coefa[isou];
4578  for (int jsou = 0; jsou < 6; jsou++) {
4579  pfac += coefb[isou][jsou]*pipr[jsou];
4580  }
4581  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4582  - imasac*b_massflux*pi[isou]);
4583  }
4584 }
4585 
4586 /*----------------------------------------------------------------------------*/
4599 /*----------------------------------------------------------------------------*/
4600 
4601 inline static void
4602 cs_b_diff_flux(const int idiffp,
4603  const cs_real_t thetap,
4604  const int inc,
4605  const cs_real_t pipr,
4606  const cs_real_t cofafp,
4607  const cs_real_t cofbfp,
4608  const cs_real_t b_visc,
4609  cs_real_t *flux)
4610 {
4611  cs_real_t pfacd = inc*cofafp + cofbfp*pipr;
4612  *flux += idiffp*thetap*b_visc*pfacd;
4613 }
4614 
4615 /*----------------------------------------------------------------------------*/
4628 /*----------------------------------------------------------------------------*/
4629 
4630 inline static void
4631 cs_b_diff_flux_vector(const int idiffp,
4632  const cs_real_t thetap,
4633  const int inc,
4634  const cs_real_3_t pipr,
4635  const cs_real_3_t cofaf,
4636  const cs_real_33_t cofbf,
4637  const cs_real_t b_visc,
4638  cs_real_t flux[3])
4639 {
4640  cs_real_t pfacd ;
4641  for (int isou = 0; isou < 3; isou++) {
4642  pfacd = inc*cofaf[isou];
4643  for (int jsou = 0; jsou < 3; jsou++) {
4644  pfacd += cofbf[isou][jsou]*pipr[jsou];
4645  }
4646  flux[isou] += idiffp*thetap*b_visc*pfacd;
4647  }
4648 }
4649 
4650 /*----------------------------------------------------------------------------*/
4663 /*----------------------------------------------------------------------------*/
4664 
4665 inline static void
4666 cs_b_diff_flux_tensor(const int idiffp,
4667  const cs_real_t thetap,
4668  const int inc,
4669  const cs_real_6_t pipr,
4670  const cs_real_6_t cofaf,
4671  const cs_real_66_t cofbf,
4672  const cs_real_t b_visc,
4673  cs_real_t flux[6])
4674 {
4675  cs_real_t pfacd ;
4676  for (int isou = 0; isou < 6; isou++) {
4677  pfacd = inc*cofaf[isou];
4678  for (int jsou = 0; jsou < 6; jsou++) {
4679  pfacd += cofbf[isou][jsou]*pipr[jsou];
4680  }
4681  flux[isou] += idiffp*thetap*b_visc*pfacd;
4682  }
4683 }
4684 
4685 /*----------------------------------------------------------------------------*/
4699 /*----------------------------------------------------------------------------*/
4700 
4701 inline static void
4702 cs_b_cd_steady(const int ircflp,
4703  const double relaxp,
4704  const cs_real_3_t diipb,
4705  const cs_real_3_t gradi,
4706  const cs_real_t pi,
4707  const cs_real_t pia,
4708  cs_real_t *pir,
4709  cs_real_t *pipr)
4710 {
4711  cs_real_t recoi;
4712 
4714  gradi,
4715  ircflp,
4716  &recoi);
4717 
4718  cs_b_relax_c_val(relaxp,
4719  pi,
4720  pia,
4721  recoi,
4722  pir,
4723  pipr);
4724 }
4725 
4726 /*----------------------------------------------------------------------------*/
4740 /*----------------------------------------------------------------------------*/
4741 
4742 inline static void
4743 cs_b_cd_steady_vector(const int ircflp,
4744  const double relaxp,
4745  const cs_real_3_t diipb,
4746  const cs_real_33_t gradi,
4747  const cs_real_3_t pi,
4748  const cs_real_3_t pia,
4749  cs_real_t pir[3],
4750  cs_real_t pipr[3])
4751 {
4752  cs_real_3_t recoi;
4753 
4755  gradi,
4756  ircflp,
4757  recoi);
4758 
4759  cs_b_relax_c_val_vector(relaxp,
4760  pi,
4761  pia,
4762  recoi,
4763  pir,
4764  pipr);
4765 }
4766 
4767 /*----------------------------------------------------------------------------*/
4781 /*----------------------------------------------------------------------------*/
4782 
4783 inline static void
4784 cs_b_cd_steady_tensor(const int ircflp,
4785  const double relaxp,
4786  const cs_real_3_t diipb,
4787  const cs_real_63_t gradi,
4788  const cs_real_6_t pi,
4789  const cs_real_6_t pia,
4790  cs_real_t pir[6],
4791  cs_real_t pipr[6])
4792 {
4793  cs_real_6_t recoi;
4794 
4796  gradi,
4797  ircflp,
4798  recoi);
4799 
4800  cs_b_relax_c_val_tensor(relaxp,
4801  pi,
4802  pia,
4803  recoi,
4804  pir,
4805  pipr);
4806 }
4807 
4808 /*----------------------------------------------------------------------------*/
4819 /*----------------------------------------------------------------------------*/
4820 
4821 inline static void
4822 cs_b_cd_unsteady(const int ircflp,
4823  const cs_real_3_t diipb,
4824  const cs_real_3_t gradi,
4825  const cs_real_t pi,
4826  cs_real_t *pip)
4827 {
4828  cs_real_t recoi;
4829 
4831  gradi,
4832  ircflp,
4833  &recoi);
4834 
4835  *pip = pi + recoi;
4836 }
4837 
4838 /*----------------------------------------------------------------------------*/
4849 /*----------------------------------------------------------------------------*/
4850 
4851 inline static void
4852 cs_b_cd_unsteady_vector(const int ircflp,
4853  const cs_real_3_t diipb,
4854  const cs_real_33_t gradi,
4855  const cs_real_3_t pi,
4856  cs_real_t pip[3])
4857 {
4858  cs_real_3_t recoi;
4859 
4861  gradi,
4862  ircflp,
4863  recoi);
4864 
4865  for (int isou = 0; isou < 3; isou++)
4866  pip[isou] = pi[isou] + recoi[isou];
4867 }
4868 
4869 /*----------------------------------------------------------------------------*/
4880 /*----------------------------------------------------------------------------*/
4881 
4882 inline static void
4883 cs_b_cd_unsteady_tensor(const int ircflp,
4884  const cs_real_3_t diipb,
4885  const cs_real_63_t gradi,
4886  const cs_real_6_t pi,
4887  cs_real_t pip[6])
4888 {
4889  cs_real_6_t recoi;
4890 
4892  gradi,
4893  ircflp,
4894  recoi);
4895 
4896  for(int isou = 0; isou< 6; isou++)
4897  pip[isou] = pi[isou] + recoi[isou];
4898 }
4899 
4900 /*----------------------------------------------------------------------------*/
4911 /*----------------------------------------------------------------------------*/
4912 
4913 inline static void
4915  cs_real_t pi,
4916  cs_real_t pj,
4917  cs_real_t b_visc,
4918  cs_real_t *fluxi)
4919 {
4920  *fluxi += idiffp*b_visc*(pi - pj);
4921 }
4922 
4923 /*----------------------------------------------------------------------------*/
4934 /*----------------------------------------------------------------------------*/
4935 
4936 inline static void
4938  const cs_real_t pi[3],
4939  const cs_real_t pj[3],
4940  cs_real_t b_visc,
4941  cs_real_t fluxi[3])
4942 {
4943  for (int k = 0; k < 3; k++)
4944  fluxi[k] += idiffp*b_visc*(pi[k] - pj[k]);
4945 }
4946 
4947 
4948 /*============================================================================
4949  * Public function prototypes for Fortran API
4950  *============================================================================*/
4951 
4952 /*----------------------------------------------------------------------------
4953  * Wrapper to cs_face_diffusion_potential
4954  *----------------------------------------------------------------------------*/
4955 
4956 void CS_PROCF (itrmas, ITRMAS)
4957 (
4958  const cs_int_t *const f_id,
4959  const cs_int_t *const init,
4960  const cs_int_t *const inc,
4961  const cs_int_t *const imrgra,
4962  const cs_int_t *const iccocg,
4963  const cs_int_t *const nswrgp,
4964  const cs_int_t *const imligp,
4965  const cs_int_t *const iphydp,
4966  const cs_int_t *const iwgrp,
4967  const cs_int_t *const iwarnp,
4968  const cs_real_t *const epsrgp,
4969  const cs_real_t *const climgp,
4970  const cs_real_t *const extrap,
4971  cs_real_3_t frcxt[],
4972  cs_real_t pvar[],
4973  const cs_real_t coefap[],
4974  const cs_real_t coefbp[],
4975  const cs_real_t cofafp[],
4976  const cs_real_t cofbfp[],
4977  const cs_real_t i_visc[],
4978  const cs_real_t b_visc[],
4979  cs_real_t visel[],
4980  cs_real_t i_massflux[],
4981  cs_real_t b_massflux[]
4982 );
4983 
4984 /*----------------------------------------------------------------------------
4985  * Wrapper to cs_face_anisotropic_diffusion_potential
4986  *----------------------------------------------------------------------------*/
4987 
4988 void CS_PROCF (itrmav, ITRMAV)
4989 (
4990  const cs_int_t *const f_id,
4991  const cs_int_t *const init,
4992  const cs_int_t *const inc,
4993  const cs_int_t *const imrgra,
4994  const cs_int_t *const iccocg,
4995  const cs_int_t *const nswrgp,
4996  const cs_int_t *const imligp,
4997  const cs_int_t *const ircflp,
4998  const cs_int_t *const iphydp,
4999  const cs_int_t *const iwgrp,
5000  const cs_int_t *const iwarnp,
5001  const cs_real_t *const epsrgp,
5002  const cs_real_t *const climgp,
5003  const cs_real_t *const extrap,
5004  cs_real_3_t frcxt[],
5005  cs_real_t pvar[],
5006  const cs_real_t coefap[],
5007  const cs_real_t coefbp[],
5008  const cs_real_t cofafp[],
5009  const cs_real_t cofbfp[],
5010  const cs_real_t i_visc[],
5011  const cs_real_t b_visc[],
5012  cs_real_6_t viscel[],
5013  const cs_real_2_t weighf[],
5014  const cs_real_t weighb[],
5015  cs_real_t i_massflux[],
5016  cs_real_t b_massflux[]
5017 );
5018 
5019 /*----------------------------------------------------------------------------
5020  * Wrapper to cs_diffusion_potential
5021  *----------------------------------------------------------------------------*/
5022 
5023 void CS_PROCF (itrgrp, ITRGRP)
5024 (
5025  const cs_int_t *const f_id,
5026  const cs_int_t *const init,
5027  const cs_int_t *const inc,
5028  const cs_int_t *const imrgra,
5029  const cs_int_t *const iccocg,
5030  const cs_int_t *const nswrgp,
5031  const cs_int_t *const imligp,
5032  const cs_int_t *const iphydp,
5033  const cs_int_t *const iwarnp,
5034  const cs_real_t *const epsrgp,
5035  const cs_real_t *const climgp,
5036  const cs_real_t *const extrap,
5037  cs_real_3_t frcxt[],
5038  cs_real_t pvar[],
5039  const cs_real_t coefap[],
5040  const cs_real_t coefbp[],
5041  const cs_real_t cofafp[],
5042  const cs_real_t cofbfp[],
5043  const cs_real_t i_visc[],
5044  const cs_real_t b_visc[],
5045  cs_real_t visel[],
5046  cs_real_t diverg[]
5047 );
5048 
5049 /*----------------------------------------------------------------------------
5050  * Wrapper to cs_anisotropic_diffusion_potential
5051  *----------------------------------------------------------------------------*/
5052 
5053 void CS_PROCF (itrgrv, ITRGRV)
5054 (
5055  const cs_int_t *const f_id,
5056  const cs_int_t *const init,
5057  const cs_int_t *const inc,
5058  const cs_int_t *const imrgra,
5059  const cs_int_t *const iccocg,
5060  const cs_int_t *const nswrgp,
5061  const cs_int_t *const imligp,
5062  const cs_int_t *const ircflp,
5063  const cs_int_t *const iphydp,
5064  const cs_int_t *const iwarnp,
5065  const cs_real_t *const epsrgp,
5066  const cs_real_t *const climgp,
5067  const cs_real_t *const extrap,
5068  cs_real_3_t frcxt[],
5069  cs_real_t pvar[],
5070  const cs_real_t coefap[],
5071  const cs_real_t coefbp[],
5072  const cs_real_t cofafp[],
5073  const cs_real_t cofbfp[],
5074  const cs_real_t i_visc[],
5075  const cs_real_t b_visc[],
5076  cs_real_6_t viscel[],
5077  const cs_real_2_t weighf[],
5078  const cs_real_t weighb[],
5079  cs_real_t diverg[]
5080 );
5081 
5082 /*=============================================================================
5083  * Public function prototypes
5084  *============================================================================*/
5085 
5086 /*----------------------------------------------------------------------------*/
5105 /*----------------------------------------------------------------------------*/
5106 
5107 void
5108 cs_slope_test_gradient(int f_id,
5109  int inc,
5110  cs_halo_type_t halo_type,
5111  const cs_real_3_t *grad,
5112  cs_real_3_t *grdpa,
5113  const cs_real_t *pvar,
5114  const cs_real_t *coefap,
5115  const cs_real_t *coefbp,
5116  const cs_real_t *i_massflux);
5117 
5118 /*----------------------------------------------------------------------------*/
5134 /*----------------------------------------------------------------------------*/
5135 
5136 void
5137 cs_upwind_gradient(const int f_id,
5138  const int inc,
5139  const cs_halo_type_t halo_type,
5140  const cs_real_t coefap[],
5141  const cs_real_t coefbp[],
5142  const cs_real_t i_massflux[],
5143  const cs_real_t b_massflux[],
5144  const cs_real_t *restrict pvar,
5145  cs_real_3_t *restrict grdpa);
5146 
5147 /*----------------------------------------------------------------------------*/
5165 /*----------------------------------------------------------------------------*/
5166 
5167 void
5168 cs_slope_test_gradient_vector(const int inc,
5169  const cs_halo_type_t halo_type,
5170  const cs_real_33_t *grad,
5171  cs_real_33_t *grdpa,
5172  const cs_real_3_t *pvar,
5173  const cs_real_3_t *coefa,
5174  const cs_real_33_t *coefb,
5175  const cs_real_t *i_massflux);
5176 
5177 /*----------------------------------------------------------------------------*/
5195 /*----------------------------------------------------------------------------*/
5196 
5197 void
5198 cs_slope_test_gradient_tensor(const int inc,
5199  const cs_halo_type_t halo_type,
5200  const cs_real_63_t *grad,
5201  cs_real_63_t *grdpa,
5202  const cs_real_6_t *pvar,
5203  const cs_real_6_t *coefa,
5204  const cs_real_66_t *coefb,
5205  const cs_real_t *i_massflux);
5206 
5207 /*----------------------------------------------------------------------------*/
5216 /*----------------------------------------------------------------------------*/
5217 
5218 void
5219 cs_max_limiter_building(int f_id,
5220  int inc,
5221  const cs_real_t rovsdt[]);
5222 
5223 /*----------------------------------------------------------------------------*/
5275 /*----------------------------------------------------------------------------*/
5276 
5277 void
5279  int f_id,
5280  const cs_var_cal_opt_t var_cal_opt,
5281  int icvflb,
5282  int inc,
5283  int iccocg,
5284  int imasac,
5285  cs_real_t *restrict pvar,
5286  const cs_real_t *restrict pvara,
5287  const cs_int_t icvfli[],
5288  const cs_real_t coefap[],
5289  const cs_real_t coefbp[],
5290  const cs_real_t cofafp[],
5291  const cs_real_t cofbfp[],
5292  const cs_real_t i_massflux[],
5293  const cs_real_t b_massflux[],
5294  const cs_real_t i_visc[],
5295  const cs_real_t b_visc[],
5296  cs_real_t *restrict rhs);
5297 
5298 /*----------------------------------------------------------------------------*/
5358 /*----------------------------------------------------------------------------*/
5359 
5360 void
5362  int f_id,
5363  const cs_var_cal_opt_t var_cal_opt,
5364  int icvflb,
5365  int inc,
5366  int ivisep,
5367  int imasac,
5368  cs_real_3_t *restrict pvar,
5369  const cs_real_3_t *restrict pvara,
5370  const cs_int_t icvfli[],
5371  const cs_real_3_t coefav[],
5372  const cs_real_33_t coefbv[],
5373  const cs_real_3_t cofafv[],
5374  const cs_real_33_t cofbfv[],
5375  const cs_real_t i_massflux[],
5376  const cs_real_t b_massflux[],
5377  const cs_real_t i_visc[],
5378  const cs_real_t b_visc[],
5379  const cs_real_t secvif[],
5380  const cs_real_t secvib[],
5381  cs_real_3_t *restrict rhs);
5382 
5383 /*----------------------------------------------------------------------------*/
5428 /*----------------------------------------------------------------------------*/
5429 
5430 void
5432  int f_id,
5433  const cs_var_cal_opt_t var_cal_opt,
5434  int icvflb,
5435  int inc,
5436  int imasac,
5437  cs_real_6_t *restrict pvar,
5438  const cs_real_6_t *restrict pvara,
5439  const cs_real_6_t coefa[],
5440  const cs_real_66_t coefb[],
5441  const cs_real_6_t cofaf[],
5442  const cs_real_66_t cofbf[],
5443  const cs_real_t i_massflux[],
5444  const cs_real_t b_massflux[],
5445  const cs_real_t i_visc[],
5446  const cs_real_t b_visc[],
5447  cs_real_6_t *restrict rhs);
5448 
5449 /*----------------------------------------------------------------------------*/
5495 /*----------------------------------------------------------------------------*/
5496 
5497 void
5499  int f_id,
5500  const cs_var_cal_opt_t var_cal_opt,
5501  int inc,
5502  int iccocg,
5503  int imasac,
5504  cs_real_t *restrict pvar,
5505  const cs_real_t *restrict pvara,
5506  const cs_real_t coefap[],
5507  const cs_real_t coefbp[],
5508  const cs_real_t cofafp[],
5509  const cs_real_t cofbfp[],
5510  const cs_real_t i_massflux[],
5511  const cs_real_t b_massflux[],
5512  const cs_real_t i_visc[],
5513  const cs_real_t b_visc[],
5514  const cs_real_t xcpp[],
5515  cs_real_t *restrict rhs);
5516 
5517 /*----------------------------------------------------------------------------*/
5565 /*----------------------------------------------------------------------------*/
5566 
5567 void
5569  int f_id,
5570  const cs_var_cal_opt_t var_cal_opt,
5571  int inc,
5572  int iccocg,
5573  cs_real_t *restrict pvar,
5574  const cs_real_t *restrict pvara,
5575  const cs_real_t coefap[],
5576  const cs_real_t coefbp[],
5577  const cs_real_t cofafp[],
5578  const cs_real_t cofbfp[],
5579  const cs_real_t i_visc[],
5580  const cs_real_t b_visc[],
5581  cs_real_6_t *restrict viscel,
5582  const cs_real_2_t weighf[],
5583  const cs_real_t weighb[],
5584  cs_real_t *restrict rhs);
5585 
5586 /*-----------------------------------------------------------------------------*/
5636 /*----------------------------------------------------------------------------*/
5637 
5638 void
5640  int f_id,
5641  const cs_var_cal_opt_t var_cal_opt,
5642  int inc,
5643  int ivisep,
5644  cs_real_3_t *restrict pvar,
5645  const cs_real_3_t *restrict pvara,
5646  const cs_real_3_t coefav[],
5647  const cs_real_33_t coefbv[],
5648  const cs_real_3_t cofafv[],
5649  const cs_real_33_t cofbfv[],
5650  const cs_real_33_t i_visc[],
5651  const cs_real_t b_visc[],
5652  const cs_real_t secvif[],
5653  cs_real_3_t *restrict rhs);
5654 
5655 /*-----------------------------------------------------------------------------*/
5701 /*----------------------------------------------------------------------------*/
5702 
5703 void
5705  int f_id,
5706  const cs_var_cal_opt_t var_cal_opt,
5707  int inc,
5708  cs_real_3_t *restrict pvar,
5709  const cs_real_3_t *restrict pvara,
5710  const cs_real_3_t coefav[],
5711  const cs_real_33_t coefbv[],
5712  const cs_real_3_t cofafv[],
5713  const cs_real_33_t cofbfv[],
5714  const cs_real_t i_visc[],
5715  const cs_real_t b_visc[],
5716  const cs_real_t secvif[],
5717  cs_real_6_t *restrict viscel,
5718  const cs_real_2_t weighf[],
5719  const cs_real_t weighb[],
5720  cs_real_3_t *restrict rhs);
5721 
5722 /*----------------------------------------------------------------------------*/
5766 /*----------------------------------------------------------------------------*/
5767 
5768 void
5770  int f_id,
5771  const cs_var_cal_opt_t var_cal_opt,
5772  int inc,
5773  cs_real_6_t *restrict pvar,
5774  const cs_real_6_t *restrict pvara,
5775  const cs_real_6_t coefa[],
5776  const cs_real_66_t coefb[],
5777  const cs_real_6_t cofaf[],
5778  const cs_real_66_t cofbf[],
5779  const cs_real_t i_visc[],
5780  const cs_real_t b_visc[],
5781  cs_real_6_t *restrict viscel,
5782  const cs_real_2_t weighf[],
5783  const cs_real_t weighb[],
5784  cs_real_6_t *restrict rhs);
5785 
5786 /*----------------------------------------------------------------------------*/
5846 /*----------------------------------------------------------------------------*/
5847 
5848 void
5849 cs_face_diffusion_potential(const int f_id,
5850  const cs_mesh_t *m,
5851  cs_mesh_quantities_t *fvq,
5852  int init,
5853  int inc,
5854  int imrgra,
5855  int iccocg,
5856  int nswrgp,
5857  int imligp,
5858  int iphydp,
5859  int iwgrp,
5860  int iwarnp,
5861  double epsrgp,
5862  double climgp,
5863  double extrap,
5864  cs_real_3_t *restrict frcxt,
5865  cs_real_t *restrict pvar,
5866  const cs_real_t coefap[],
5867  const cs_real_t coefbp[],
5868  const cs_real_t cofafp[],
5869  const cs_real_t cofbfp[],
5870  const cs_real_t i_visc[],
5871  const cs_real_t b_visc[],
5872  cs_real_t *restrict visel,
5873  cs_real_t *restrict i_massflux,
5874  cs_real_t *restrict b_massflux);
5875 
5876 /*----------------------------------------------------------------------------*/
5947 /*----------------------------------------------------------------------------*/
5948 
5949 void
5951  const cs_mesh_t *m,
5952  cs_mesh_quantities_t *fvq,
5953  int init,
5954  int inc,
5955  int imrgra,
5956  int iccocg,
5957  int nswrgp,
5958  int imligp,
5959  int ircflp,
5960  int iphydp,
5961  int iwgrp,
5962  int iwarnp,
5963  double epsrgp,
5964  double climgp,
5965  double extrap,
5966  cs_real_3_t *restrict frcxt,
5967  cs_real_t *restrict pvar,
5968  const cs_real_t coefap[],
5969  const cs_real_t coefbp[],
5970  const cs_real_t cofafp[],
5971  const cs_real_t cofbfp[],
5972  const cs_real_t i_visc[],
5973  const cs_real_t b_visc[],
5974  cs_real_6_t *restrict viscel,
5975  const cs_real_2_t weighf[],
5976  const cs_real_t weighb[],
5977  cs_real_t *restrict i_massflux,
5978  cs_real_t *restrict b_massflux);
5979 
5980 /*----------------------------------------------------------------------------*/
6036 /*----------------------------------------------------------------------------*/
6037 
6038 void
6039 cs_diffusion_potential(const int f_id,
6040  const cs_mesh_t *m,
6041  cs_mesh_quantities_t *fvq,
6042  int init,
6043  int inc,
6044  int imrgra,
6045  int iccocg,
6046  int nswrgp,
6047  int imligp,
6048  int iphydp,
6049  int iwarnp,
6050  double epsrgp,
6051  double climgp,
6052  double extrap,
6053  cs_real_3_t *restrict frcxt,
6054  cs_real_t *restrict pvar,
6055  const cs_real_t coefap[],
6056  const cs_real_t coefbp[],
6057  const cs_real_t cofafp[],
6058  const cs_real_t cofbfp[],
6059  const cs_real_t i_visc[],
6060  const cs_real_t b_visc[],
6061  cs_real_t visel[],
6062  cs_real_t *restrict diverg);
6063 
6064 /*----------------------------------------------------------------------------*/
6133 /*----------------------------------------------------------------------------*/
6134 
6135 void
6136 cs_anisotropic_diffusion_potential(const int f_id,
6137  const cs_mesh_t *m,
6138  cs_mesh_quantities_t *fvq,
6139  int init,
6140  int inc,
6141  int imrgra,
6142  int iccocg,
6143  int nswrgp,
6144  int imligp,
6145  int ircflp,
6146  int iphydp,
6147  int iwarnp,
6148  double epsrgp,
6149  double climgp,
6150  double extrap,
6151  cs_real_3_t *restrict frcxt,
6152  cs_real_t *restrict pvar,
6153  const cs_real_t coefap[],
6154  const cs_real_t coefbp[],
6155  const cs_real_t cofafp[],
6156  const cs_real_t cofbfp[],
6157  const cs_real_t i_visc[],
6158  const cs_real_t b_visc[],
6159  cs_real_6_t *restrict viscel,
6160  const cs_real_2_t weighf[],
6161  const cs_real_t weighb[],
6162  cs_real_t *restrict diverg);
6163 
6164 /*----------------------------------------------------------------------------*/
6165 
6167 
6168 #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:4702
Definition: cs_field_pointer.h:70
static void cs_upwind_f_val_vector(const cs_real_3_t p, cs_real_t pf[3])
Prepare value at face ij by using an upwind scheme.
Definition: cs_convection_diffusion.h:681
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:254
static void cs_slope_test_vector_old(const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_3_t i_face_normal, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_t i_massflux, cs_real_t testij[3], cs_real_t tesqck[3])
DEPRECATED Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:269
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:4367
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:4666
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_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 diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1776
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:8753
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 diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_t pi, const cs_real_t pj, 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:1595
static void cs_i_cd_steady_upwind_tensor(const int ircflp, const cs_real_t relaxp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pia, const cs_real_6_t pja, cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1351
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:758
cs_nvd_type_t
Definition: cs_convection_diffusion.h:85
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:6817
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:4743
static void cs_i_cd_unsteady_slope_test_vector_old(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
DEPRECATED Handle preparation of internal face values for the fluxes computation in case of a unstead...
Definition: cs_convection_diffusion.h:3638
static void cs_i_cd_unsteady_upwind(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_t pi, const cs_real_t pj, cs_real_t *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:1427
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:698
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:4822
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:316
static void cs_i_compute_quantities_vector(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t recoi[3], cs_real_t recoj[3], cs_real_t pip[3], cs_real_t pjp[3])
Reconstruct values in I&#39; and J&#39;.
Definition: cs_convection_diffusion.h:447
Definition: cs_convection_diffusion.h:94
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:1688
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:4297
double precision pi
value with 16 digits
Definition: cstnum.f90:48
#define BEGIN_C_DECLS
Definition: cs_defs.h:461
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:296
#define CS_UNUSED(x)
Definition: cs_defs.h:447
Definition: cs_parameters.h:143
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:634
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:556
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:1533
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:717
integer(c_int), pointer, save idtvar
option for a variable time step
Definition: optcal.f90:534
static void cs_i_cd_steady_slope_test_vector(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:2991
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:4155
Definition: cs_convection_diffusion.h:89
static void cs_i_cd_unsteady_vector(const int ircflp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_t hybrid_blend_i, const cs_real_t hybrid_blend_j, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:2243
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:1112
static void cs_i_cd_steady_slope_test(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_3_t gradsti, const cs_real_3_t gradstj, const cs_real_t pi, const cs_real_t pj, const cs_real_t pia, const cs_real_t pja, cs_real_t *pifri, cs_real_t *pifrj, cs_real_t *pjfri, cs_real_t *pjfrj, cs_real_t *pip, cs_real_t *pjp, cs_real_t *pipr, cs_real_t *pjpr)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:2508
Definition: cs_convection_diffusion.h:92
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:891
static void cs_i_cd_steady_slope_test_vector_old(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:2763
static void cs_i_cd_unsteady_upwind_vector(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:1477
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:840
static cs_real_t cs_math_3_square_norm(const cs_real_t v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:289
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:808
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:4497
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:121
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:1078
static void cs_b_diff_flux_coupling(int idiffp, cs_real_t pi, cs_real_t pj, cs_real_t b_visc, cs_real_t *fluxi)
Add diffusive flux to flux at an internal coupling face.
Definition: cs_convection_diffusion.h:4914
static void cs_i_cd_steady_upwind(const int ircflp, const cs_real_t relaxp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_t pi, const cs_real_t pj, 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:1184
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:4631
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:594
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:1141
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_t hybrid_blend_i, const cs_real_t hybrid_blend_j, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_t pi, const cs_real_t pj, cs_real_t *pif, cs_real_t *pjf, cs_real_t *pip, cs_real_t *pjp)
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition: cs_convection_diffusion.h:2083
Definition: cs_convection_diffusion.h:91
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:4257
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:4205
static void cs_b_diff_flux_coupling_vector(int idiffp, const cs_real_t pi[3], const cs_real_t pj[3], cs_real_t b_visc, cs_real_t fluxi[3])
Add diffusive flux to flux at an internal coupling face for a vector.
Definition: cs_convection_diffusion.h:4937
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[], const cs_real_t secvib[], 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:3355
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:780
Definition: cs_mesh_quantities.h:85
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:9708
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 diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:2384
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:4445
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:10556
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:132
Definition: cs_convection_diffusion.h:88
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:4179
static void cs_slope_test_tensor(const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_3_t i_face_normal, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t gradsti, const cs_real_63_t gradstj, const cs_real_t i_massflux, cs_real_t *testij, cs_real_t *tesqck)
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:336
static void cs_slope_test_vector(const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_3_t i_face_normal, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t gradsti, const cs_real_33_t gradstj, const cs_real_t i_massflux, cs_real_t *testij, cs_real_t *tesqck)
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:197
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:944
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:737
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:4883
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:9354
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:309
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:4553
static void cs_i_cd_unsteady_upwind_tensor(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:1528
Definition: cs_convection_diffusion.h:100
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:1257
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:988
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:1036
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:4692
double precision, save fmin
Definition: coincl.f90:133
structure containing the variable calculation options.
Definition: cs_parameters.h:60
static void cs_i_cd_unsteady_slope_test_vector(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition: cs_convection_diffusion.h:3811
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:4133
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:1108
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:1171
Definition: cs_convection_diffusion.h:96
static cs_real_t cs_math_3_square_distance(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the squared distance between two points xa and xb in a cartesian coordinate system of dimensi...
Definition: cs_math.h:232
static void cs_i_cd_unsteady_slope_test(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_3_t gradsti, const cs_real_3_t gradstj, const cs_real_t pi, const cs_real_t pj, cs_real_t *pif, cs_real_t *pjf, cs_real_t *pip, cs_real_t *pjp)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:3453
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:980
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:10176
#define END_C_DECLS
Definition: cs_defs.h:462
Definition: cs_convection_diffusion.h:93
Definition: cs_convection_diffusion.h:98
static void cs_i_compute_quantities_tensor(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t recoi[6], cs_real_t recoj[6], cs_real_t pip[6], cs_real_t pjp[6])
Reconstruct values in I&#39; and J&#39;.
Definition: cs_convection_diffusion.h:502
#define CS_PROCF(x, y)
Definition: cs_defs.h:475
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:315
static void cs_i_compute_quantities(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_t pi, const cs_real_t pj, cs_real_t *recoi, cs_real_t *recoj, cs_real_t *pip, cs_real_t *pjp)
Reconstruct values in I&#39; and J&#39;.
Definition: cs_convection_diffusion.h:404
Definition: cs_convection_diffusion.h:97
Definition: cs_convection_diffusion.h:87
Definition: cs_convection_diffusion.h:90
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:1985
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:912
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:321
static void cs_b_cd_unsteady_vector(const int ircflp, const cs_real_3_t diipb, const cs_real_33_t gradi, const cs_real_3_t pi, cs_real_t pip[3])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm...
Definition: cs_convection_diffusion.h:4852
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 diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pia, const cs_real_6_t pja, cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1929
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:4784
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:1834
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:665
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:5607
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:4602
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:1401
void cs_anisotropic_right_diffusion_vector(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const cs_real_3_t coefav[], const cs_real_33_t coefbv[], const cs_real_3_t cofafv[], const cs_real_33_t cofbfv[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t secvif[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_3_t *restrict rhs)
Add explicit part of the terms of diffusion by a right-multiplying symmetric tensorial diffusivity fo...
Definition: cs_convection_diffusion.c:8067
static void cs_i_cd_steady_slope_test_tensor(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t grdpai, const cs_real_63_t grdpaj, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pia, const cs_real_6_t pja, cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:3223
Definition: cs_convection_diffusion.h:95
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:1043
static void cs_i_cd_unsteady_slope_test_tensor(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t grdpai, const cs_real_63_t grdpaj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition: cs_convection_diffusion.h:3985
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:4230
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:871
static void cs_i_cd_steady_upwind_vector(const int ircflp, const cs_real_t relaxp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1267
Definition: cs_convection_diffusion.h:99
void cs_anisotropic_left_diffusion_vector(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int ivisep, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const cs_real_3_t coefav[], const cs_real_33_t coefbv[], const cs_real_3_t cofafv[], const cs_real_33_t cofbfv[], const cs_real_33_t i_visc[], const cs_real_t b_visc[], const cs_real_t secvif[], cs_real_3_t *restrict rhs)
Add explicit part of the terms of diffusion by a left-multiplying symmetric tensorial diffusivity for...
Definition: cs_convection_diffusion.c:7540