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