8.1
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  /* Blending
2434  --------*/
2435 
2436  cs_blend_f_val(blencp,
2437  pi,
2438  pif);
2439  cs_blend_f_val(blencp,
2440  pj,
2441  pjf);
2442 }
2443 
2444 /*----------------------------------------------------------------------------*/
2470 /*----------------------------------------------------------------------------*/
2471 
2472 inline static void
2474  const int ischcp,
2475  const double blencp,
2476  const cs_real_t weight,
2477  const cs_real_3_t cell_ceni,
2478  const cs_real_3_t cell_cenj,
2479  const cs_real_3_t i_face_cog,
2480  const cs_real_t hybrid_blend_i,
2481  const cs_real_t hybrid_blend_j,
2482  const cs_real_3_t diipf,
2483  const cs_real_3_t djjpf,
2484  const cs_real_33_t gradi,
2485  const cs_real_33_t gradj,
2486  const cs_real_3_t pi,
2487  const cs_real_3_t pj,
2488  cs_real_t pif[3],
2489  cs_real_t pjf[3],
2490  cs_real_t pip[3],
2491  cs_real_t pjp[3])
2492 
2493 {
2494  cs_real_t recoi[3], recoj[3];
2495 
2497  diipf,
2498  djjpf,
2499  gradi,
2500  gradj,
2501  pi,
2502  pj,
2503  recoi,
2504  recoj,
2505  pip,
2506  pjp);
2507 
2508  if (ischcp == 1) {
2509 
2510  /* Centered
2511  --------*/
2512 
2513  cs_centered_f_val_vector(weight,
2514  pip,
2515  pjp,
2516  pif);
2517  cs_centered_f_val_vector(weight,
2518  pip,
2519  pjp,
2520  pjf);
2521  } else if (ischcp == 3) {
2522 
2523  /* Centered
2524  --------*/
2525 
2526  cs_centered_f_val_vector(weight,
2527  pip,
2528  pjp,
2529  pif);
2530  cs_centered_f_val_vector(weight,
2531  pip,
2532  pjp,
2533  pjf);
2534 
2535  /* SOLU
2536  -----*/
2537  cs_real_t pif_up[3], pjf_up[3];
2538  cs_real_t hybrid_blend_interp;
2539 
2540  cs_solu_f_val_vector(cell_ceni,
2541  i_face_cog,
2542  gradi,
2543  pi,
2544  pif_up);
2545  cs_solu_f_val_vector(cell_cenj,
2546  i_face_cog,
2547  gradj,
2548  pj,
2549  pjf_up);
2550 
2551  hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2552  for (int isou = 0; isou < 3; isou++) {
2553  pif[isou] = hybrid_blend_interp *pif[isou]
2554  + (1. - hybrid_blend_interp)*pif_up[isou];
2555  pjf[isou] = hybrid_blend_interp *pjf[isou]
2556  + (1. - hybrid_blend_interp)*pjf_up[isou];
2557  }
2558  } else {
2559 
2560  /* Second order
2561  ------------*/
2562 
2563  cs_solu_f_val_vector(cell_ceni,
2564  i_face_cog,
2565  gradi,
2566  pi,
2567  pif);
2568  cs_solu_f_val_vector(cell_cenj,
2569  i_face_cog,
2570  gradj,
2571  pj,
2572  pjf);
2573 
2574  }
2575 
2576  /* Blending
2577  --------*/
2578 
2579  cs_blend_f_val_vector(blencp,
2580  pi,
2581  pif);
2582  cs_blend_f_val_vector(blencp,
2583  pj,
2584  pjf);
2585 
2586 }
2587 
2588 /*----------------------------------------------------------------------------*/
2612 /*----------------------------------------------------------------------------*/
2613 
2614 inline static void
2616  const int ischcp,
2617  const double blencp,
2618  const cs_real_t weight,
2619  const cs_real_3_t cell_ceni,
2620  const cs_real_3_t cell_cenj,
2621  const cs_real_3_t i_face_cog,
2622  const cs_real_3_t diipf,
2623  const cs_real_3_t djjpf,
2624  const cs_real_63_t gradi,
2625  const cs_real_63_t gradj,
2626  const cs_real_6_t pi,
2627  const cs_real_6_t pj,
2628  cs_real_t pif[6],
2629  cs_real_t pjf[6],
2630  cs_real_t pip[6],
2631  cs_real_t pjp[6])
2632 
2633 {
2634  cs_real_t recoi[6], recoj[6];
2635 
2637  diipf,
2638  djjpf,
2639  gradi,
2640  gradj,
2641  pi,
2642  pj,
2643  recoi,
2644  recoj,
2645  pip,
2646  pjp);
2647 
2648  if (ischcp == 1) {
2649 
2650  /* Centered
2651  --------*/
2652 
2653  cs_centered_f_val_tensor(weight,
2654  pip,
2655  pjp,
2656  pif);
2657  cs_centered_f_val_tensor(weight,
2658  pip,
2659  pjp,
2660  pjf);
2661 
2662  } else {
2663 
2664  /* Second order
2665  ------------*/
2666 
2667  cs_solu_f_val_tensor(cell_ceni,
2668  i_face_cog,
2669  gradi,
2670  pi,
2671  pif);
2672  cs_solu_f_val_tensor(cell_cenj,
2673  i_face_cog,
2674  gradj,
2675  pj,
2676  pjf);
2677 
2678  }
2679 
2680  /* Blending
2681  --------*/
2682 
2683  cs_blend_f_val_tensor(blencp,
2684  pi,
2685  pif);
2686  cs_blend_f_val_tensor(blencp,
2687  pj,
2688  pjf);
2689 
2690 }
2691 
2692 /*----------------------------------------------------------------------------*/
2736 /*----------------------------------------------------------------------------*/
2737 
2738 inline static void
2739 cs_i_cd_steady_slope_test(bool *upwind_switch,
2740  const int iconvp,
2741  const cs_real_t bldfrp,
2742  const int ischcp,
2743  const double relaxp,
2744  const double blencp,
2745  const double blend_st,
2746  const cs_real_t weight,
2747  const cs_real_t i_dist,
2748  const cs_real_t i_face_surf,
2749  const cs_real_3_t cell_ceni,
2750  const cs_real_3_t cell_cenj,
2751  const cs_real_3_t i_face_normal,
2752  const cs_real_3_t i_face_cog,
2753  const cs_real_3_t diipf,
2754  const cs_real_3_t djjpf,
2755  const cs_real_t i_massflux,
2756  const cs_real_3_t gradi,
2757  const cs_real_3_t gradj,
2758  const cs_real_3_t gradupi,
2759  const cs_real_3_t gradupj,
2760  const cs_real_3_t gradsti,
2761  const cs_real_3_t gradstj,
2762  const cs_real_t pi,
2763  const cs_real_t pj,
2764  const cs_real_t pia,
2765  const cs_real_t pja,
2766  cs_real_t *pifri,
2767  cs_real_t *pifrj,
2768  cs_real_t *pjfri,
2769  cs_real_t *pjfrj,
2770  cs_real_t *pip,
2771  cs_real_t *pjp,
2772  cs_real_t *pipr,
2773  cs_real_t *pjpr)
2774 {
2775  cs_real_t pir, pjr;
2776  cs_real_t recoi, recoj;
2777  cs_real_t testij, tesqck;
2778 
2779  *upwind_switch = false;
2780 
2781  cs_i_compute_quantities(bldfrp,
2782  diipf,
2783  djjpf,
2784  gradi,
2785  gradj,
2786  pi,
2787  pj,
2788  &recoi,
2789  &recoj,
2790  pip,
2791  pjp);
2792 
2793  cs_i_relax_c_val(relaxp,
2794  pia,
2795  pja,
2796  recoi,
2797  recoj,
2798  pi,
2799  pj,
2800  &pir,
2801  &pjr,
2802  pipr,
2803  pjpr);
2804 
2805  /* Convection slope test is needed only when iconv >0 */
2806  if (iconvp > 0) {
2807  cs_slope_test(pi,
2808  pj,
2809  i_dist,
2810  i_face_surf,
2811  i_face_normal,
2812  gradi,
2813  gradj,
2814  gradsti,
2815  gradstj,
2816  i_massflux,
2817  &testij,
2818  &tesqck);
2819 
2820  if (ischcp==1) {
2821 
2822  /* Centered
2823  --------*/
2824 
2825  cs_centered_f_val(weight,
2826  *pip,
2827  *pjpr,
2828  pifrj);
2829  cs_centered_f_val(weight,
2830  *pipr,
2831  *pjp,
2832  pifri);
2833  cs_centered_f_val(weight,
2834  *pipr,
2835  *pjp,
2836  pjfri);
2837  cs_centered_f_val(weight,
2838  *pip,
2839  *pjpr,
2840  pjfrj);
2841 
2842  } else if (ischcp == 0) {
2843 
2844  /* Second order
2845  ------------*/
2846 
2847  cs_solu_f_val(cell_ceni,
2848  i_face_cog,
2849  gradi,
2850  pi,
2851  pifrj);
2852  cs_solu_f_val(cell_ceni,
2853  i_face_cog,
2854  gradi,
2855  pir,
2856  pifri);
2857  cs_solu_f_val(cell_cenj,
2858  i_face_cog,
2859  gradj,
2860  pj,
2861  pjfri);
2862  cs_solu_f_val(cell_cenj,
2863  i_face_cog,
2864  gradj,
2865  pjr,
2866  pjfrj);
2867 
2868  } else {
2869 
2870  /* SOLU
2871  -----*/
2872 
2873  cs_solu_f_val(cell_ceni,
2874  i_face_cog,
2875  gradupi,
2876  pi,
2877  pifrj);
2878  cs_solu_f_val(cell_ceni,
2879  i_face_cog,
2880  gradupi,
2881  pir,
2882  pifri);
2883  cs_solu_f_val(cell_cenj,
2884  i_face_cog,
2885  gradupj,
2886  pj,
2887  pjfri);
2888  cs_solu_f_val(cell_cenj,
2889  i_face_cog,
2890  gradupj,
2891  pjr,
2892  pjfrj);
2893  }
2894 
2895 
2896  /* Slope test: Pourcentage of upwind
2897  ----------------------------------*/
2898 
2899  if (tesqck <= 0. || testij <= 0.) {
2900 
2901  cs_blend_f_val(blend_st,
2902  pi,
2903  pifrj);
2904  cs_blend_f_val(blend_st,
2905  pir,
2906  pifri);
2907  cs_blend_f_val(blend_st,
2908  pj,
2909  pjfri);
2910  cs_blend_f_val(blend_st,
2911  pjr,
2912  pjfrj);
2913 
2914  *upwind_switch = true;
2915 
2916  }
2917 
2918 
2919  /* Blending
2920  --------*/
2921 
2922  cs_blend_f_val(blencp,
2923  pi,
2924  pifrj);
2925  cs_blend_f_val(blencp,
2926  pir,
2927  pifri);
2928  cs_blend_f_val(blencp,
2929  pj,
2930  pjfri);
2931  cs_blend_f_val(blencp,
2932  pjr,
2933  pjfrj);
2934 
2935  /* If iconv=0 p*fr* are useless */
2936  } else {
2938  pifrj);
2939  cs_upwind_f_val(pir,
2940  pifri);
2941  cs_upwind_f_val(pj,
2942  pjfri);
2943  cs_upwind_f_val(pjr,
2944  pjfrj);
2945  }
2946 
2947 }
2948 
2949 /*----------------------------------------------------------------------------*/
2991 /*----------------------------------------------------------------------------*/
2992 
2993 inline static void
2995  const int iconvp,
2996  const cs_real_t bldfrp,
2997  const int ischcp,
2998  const double relaxp,
2999  const double blencp,
3000  const double blend_st,
3001  const cs_real_t weight,
3002  const cs_real_t i_dist,
3003  const cs_real_t i_face_surf,
3004  const cs_real_3_t cell_ceni,
3005  const cs_real_3_t cell_cenj,
3006  const cs_real_3_t i_face_normal,
3007  const cs_real_3_t i_face_cog,
3008  const cs_real_3_t diipf,
3009  const cs_real_3_t djjpf,
3010  const cs_real_t i_massflux,
3011  const cs_real_33_t gradi,
3012  const cs_real_33_t gradj,
3013  const cs_real_33_t grdpai,
3014  const cs_real_33_t grdpaj,
3015  const cs_real_3_t pi,
3016  const cs_real_3_t pj,
3017  const cs_real_3_t pia,
3018  const cs_real_3_t pja,
3019  cs_real_t pifri[3],
3020  cs_real_t pifrj[3],
3021  cs_real_t pjfri[3],
3022  cs_real_t pjfrj[3],
3023  cs_real_t pip[3],
3024  cs_real_t pjp[3],
3025  cs_real_t pipr[3],
3026  cs_real_t pjpr[3])
3027 {
3028  cs_real_t pir[3], pjr[3];
3029  cs_real_t recoi[3], recoj[3];
3030  cs_real_t testij, tesqck;
3031  int isou;
3032 
3034  diipf,
3035  djjpf,
3036  gradi,
3037  gradj,
3038  pi,
3039  pj,
3040  recoi,
3041  recoj,
3042  pip,
3043  pjp);
3044 
3045  cs_i_relax_c_val_vector(relaxp,
3046  pia,
3047  pja,
3048  recoi,
3049  recoj,
3050  pi,
3051  pj,
3052  pir,
3053  pjr,
3054  pipr,
3055  pjpr);
3056 
3057  /* Convection slope test is needed only when iconv >0 */
3058  if (iconvp > 0) {
3060  pj,
3061  i_dist,
3062  i_face_surf,
3063  i_face_normal,
3064  gradi,
3065  gradj,
3066  grdpai,
3067  grdpaj,
3068  i_massflux,
3069  &testij,
3070  &tesqck);
3071 
3072  for (isou = 0; isou < 3; isou++) {
3073  if (ischcp==1) {
3074 
3075  /* Centered
3076  --------*/
3077 
3078  cs_centered_f_val(weight,
3079  pip[isou],
3080  pjpr[isou],
3081  &pifrj[isou]);
3082  cs_centered_f_val(weight,
3083  pipr[isou],
3084  pjp[isou],
3085  &pifri[isou]);
3086  cs_centered_f_val(weight,
3087  pipr[isou],
3088  pjp[isou],
3089  &pjfri[isou]);
3090  cs_centered_f_val(weight,
3091  pip[isou],
3092  pjpr[isou],
3093  &pjfrj[isou]);
3094 
3095  } else {
3096 
3097  /* Second order
3098  ------------*/
3099 
3100  cs_solu_f_val(cell_ceni,
3101  i_face_cog,
3102  gradi[isou],
3103  pi[isou],
3104  &pifrj[isou]);
3105  cs_solu_f_val(cell_ceni,
3106  i_face_cog,
3107  gradi[isou],
3108  pir[isou],
3109  &pifri[isou]);
3110  cs_solu_f_val(cell_cenj,
3111  i_face_cog,
3112  gradj[isou],
3113  pj[isou],
3114  &pjfri[isou]);
3115  cs_solu_f_val(cell_cenj,
3116  i_face_cog,
3117  gradj[isou],
3118  pjr[isou],
3119  &pjfrj[isou]);
3120 
3121  }
3122 
3123  }
3124 
3125  /* Slope test: Pourcentage of upwind
3126  ----------------------------------*/
3127 
3128  if (tesqck <= 0. || testij <= 0.) {
3129  cs_blend_f_val_vector(blend_st,
3130  pi,
3131  pifrj);
3132  cs_blend_f_val_vector(blend_st,
3133  pir,
3134  pifri);
3135  cs_blend_f_val_vector(blend_st,
3136  pj,
3137  pjfri);
3138  cs_blend_f_val_vector(blend_st,
3139  pjr,
3140  pjfrj);
3141 
3142  *upwind_switch = true;
3143  }
3144 
3145 
3146  /* Blending
3147  --------*/
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  }
3164  else {
3165  for (isou = 0; isou < 3; isou++) {
3166  cs_upwind_f_val(pi[isou],
3167  &pifrj[isou]);
3168  cs_upwind_f_val(pir[isou],
3169  &pifri[isou]);
3170  cs_upwind_f_val(pj[isou],
3171  &pjfri[isou]);
3172  cs_upwind_f_val(pjr[isou],
3173  &pjfrj[isou]);
3174  }
3175  }
3176 
3177 }
3178 
3179 /*----------------------------------------------------------------------------*/
3221 /*----------------------------------------------------------------------------*/
3222 
3223 inline static void
3225  const int iconvp,
3226  const cs_real_t bldfrp,
3227  const int ischcp,
3228  const double relaxp,
3229  const double blencp,
3230  const double blend_st,
3231  const cs_real_t weight,
3232  const cs_real_t i_dist,
3233  const cs_real_t i_face_surf,
3234  const cs_real_3_t cell_ceni,
3235  const cs_real_3_t cell_cenj,
3236  const cs_real_3_t i_face_normal,
3237  const cs_real_3_t i_face_cog,
3238  const cs_real_3_t diipf,
3239  const cs_real_3_t djjpf,
3240  const cs_real_t i_massflux,
3241  const cs_real_63_t gradi,
3242  const cs_real_63_t gradj,
3243  const cs_real_63_t grdpai,
3244  const cs_real_63_t grdpaj,
3245  const cs_real_6_t pi,
3246  const cs_real_6_t pj,
3247  const cs_real_6_t pia,
3248  const cs_real_6_t pja,
3249  cs_real_t pifri[6],
3250  cs_real_t pifrj[6],
3251  cs_real_t pjfri[6],
3252  cs_real_t pjfrj[6],
3253  cs_real_t pip[6],
3254  cs_real_t pjp[6],
3255  cs_real_t pipr[6],
3256  cs_real_t pjpr[6])
3257 {
3258  cs_real_t pir[6], pjr[6];
3259  cs_real_t recoi[6], recoj[6];
3260  cs_real_t testij, tesqck;
3261  int isou;
3262 
3264  diipf,
3265  djjpf,
3266  gradi,
3267  gradj,
3268  pi,
3269  pj,
3270  recoi,
3271  recoj,
3272  pip,
3273  pjp);
3274 
3275  cs_i_relax_c_val_tensor(relaxp,
3276  pia,
3277  pja,
3278  recoi,
3279  recoj,
3280  pi,
3281  pj,
3282  pir,
3283  pjr,
3284  pipr,
3285  pjpr);
3286 
3287  /* Convection slope test is needed only when iconv >0 */
3288  if (iconvp > 0) {
3290  pj,
3291  i_dist,
3292  i_face_surf,
3293  i_face_normal,
3294  gradi,
3295  gradj,
3296  grdpai,
3297  grdpaj,
3298  i_massflux,
3299  &testij,
3300  &tesqck);
3301 
3302  for (isou = 0; isou < 6; isou++) {
3303  if (ischcp==1) {
3304 
3305  /* Centered
3306  --------*/
3307 
3308  cs_centered_f_val(weight,
3309  pip[isou],
3310  pjpr[isou],
3311  &pifrj[isou]);
3312  cs_centered_f_val(weight,
3313  pipr[isou],
3314  pjp[isou],
3315  &pifri[isou]);
3316  cs_centered_f_val(weight,
3317  pipr[isou],
3318  pjp[isou],
3319  &pjfri[isou]);
3320  cs_centered_f_val(weight,
3321  pip[isou],
3322  pjpr[isou],
3323  &pjfrj[isou]);
3324 
3325  } else {
3326 
3327  /* Second order
3328  ------------*/
3329 
3330  cs_solu_f_val(cell_ceni,
3331  i_face_cog,
3332  gradi[isou],
3333  pi[isou],
3334  &pifrj[isou]);
3335  cs_solu_f_val(cell_ceni,
3336  i_face_cog,
3337  gradi[isou],
3338  pir[isou],
3339  &pifri[isou]);
3340  cs_solu_f_val(cell_cenj,
3341  i_face_cog,
3342  gradj[isou],
3343  pj[isou],
3344  &pjfri[isou]);
3345  cs_solu_f_val(cell_cenj,
3346  i_face_cog,
3347  gradj[isou],
3348  pjr[isou],
3349  &pjfrj[isou]);
3350 
3351  }
3352 
3353  }
3354 
3355  /* Slope test: Pourcentage of upwind
3356  ----------------------------------*/
3357 
3358  if (tesqck <= 0. || testij <= 0.) {
3359 
3360  cs_blend_f_val_tensor(blend_st,
3361  pi,
3362  pifrj);
3363  cs_blend_f_val_tensor(blend_st,
3364  pir,
3365  pifri);
3366  cs_blend_f_val_tensor(blend_st,
3367  pj,
3368  pjfri);
3369  cs_blend_f_val_tensor(blend_st,
3370  pjr,
3371  pjfrj);
3372 
3373  *upwind_switch = true;
3374 
3375  }
3376 
3377 
3378  /* Blending
3379  --------*/
3380 
3381  cs_blend_f_val_tensor(blencp,
3382  pi,
3383  pifrj);
3384  cs_blend_f_val_tensor(blencp,
3385  pir,
3386  pifri);
3387  cs_blend_f_val_tensor(blencp,
3388  pj,
3389  pjfri);
3390  cs_blend_f_val_tensor(blencp,
3391  pjr,
3392  pjfrj);
3393 
3394  /* If iconv=0 p*fr* are useless */
3395  } else {
3396  for (isou = 0; isou < 6; isou++) {
3397  cs_upwind_f_val(pi[isou],
3398  &pifrj[isou]);
3399  cs_upwind_f_val(pir[isou],
3400  &pifri[isou]);
3401  cs_upwind_f_val(pj[isou],
3402  &pjfri[isou]);
3403  cs_upwind_f_val(pjr[isou],
3404  &pjfrj[isou]);
3405  }
3406  }
3407 
3408 }
3409 
3410 /*----------------------------------------------------------------------------*/
3447 /*----------------------------------------------------------------------------*/
3448 
3449 inline static void
3450 cs_i_cd_unsteady_slope_test(bool *upwind_switch,
3451  const int iconvp,
3452  const cs_real_t bldfrp,
3453  const int ischcp,
3454  const double blencp,
3455  const double blend_st,
3456  const cs_real_t weight,
3457  const cs_real_t i_dist,
3458  const cs_real_t i_face_surf,
3459  const cs_real_3_t cell_ceni,
3460  const cs_real_3_t cell_cenj,
3461  const cs_real_3_t i_face_normal,
3462  const cs_real_3_t i_face_cog,
3463  const cs_real_3_t diipf,
3464  const cs_real_3_t djjpf,
3465  const cs_real_t i_massflux,
3466  const cs_real_3_t gradi,
3467  const cs_real_3_t gradj,
3468  const cs_real_3_t gradupi,
3469  const cs_real_3_t gradupj,
3470  const cs_real_3_t gradsti,
3471  const cs_real_3_t gradstj,
3472  const cs_real_t pi,
3473  const cs_real_t pj,
3474  cs_real_t *pif,
3475  cs_real_t *pjf,
3476  cs_real_t *pip,
3477  cs_real_t *pjp)
3478 {
3479  CS_UNUSED(blend_st);
3480 
3481  cs_real_t recoi, recoj;
3482  cs_real_t testij, tesqck;
3483 
3484  *upwind_switch = false;
3485 
3486  cs_i_compute_quantities(bldfrp,
3487  diipf,
3488  djjpf,
3489  gradi,
3490  gradj,
3491  pi,
3492  pj,
3493  &recoi,
3494  &recoj,
3495  pip,
3496  pjp);
3497 
3498  /* Convection slope test is needed only when iconv >0 */
3499  if (iconvp > 0) {
3500  cs_slope_test(pi,
3501  pj,
3502  i_dist,
3503  i_face_surf,
3504  i_face_normal,
3505  gradi,
3506  gradj,
3507  gradsti,
3508  gradstj,
3509  i_massflux,
3510  &testij,
3511  &tesqck);
3512 
3513  if (ischcp==1) {
3514 
3515  /* Centered
3516  --------*/
3517 
3518  cs_centered_f_val(weight,
3519  *pip,
3520  *pjp,
3521  pif);
3522  cs_centered_f_val(weight,
3523  *pip,
3524  *pjp,
3525  pjf);
3526 
3527  } else if (ischcp == 0) {
3528 
3529  /* Original SOLU
3530  --------------*/
3531 
3532  cs_solu_f_val(cell_ceni,
3533  i_face_cog,
3534  gradi,
3535  pi,
3536  pif);
3537  cs_solu_f_val(cell_cenj,
3538  i_face_cog,
3539  gradj,
3540  pj,
3541  pjf);
3542 
3543  } else {
3544 
3545  /* SOLU
3546  -----*/
3547 
3548  cs_solu_f_val(cell_ceni,
3549  i_face_cog,
3550  gradupi,
3551  pi,
3552  pif);
3553  cs_solu_f_val(cell_cenj,
3554  i_face_cog,
3555  gradupj,
3556  pj,
3557  pjf);
3558 
3559  }
3560 
3561  /* Slope test: Pourcentage of upwind
3562  ----------------------------------*/
3563 
3564  if (tesqck<=0. || testij<=0.) {
3565 
3566  cs_blend_f_val(blend_st,
3567  pi,
3568  pif);
3569  cs_blend_f_val(blend_st,
3570  pj,
3571  pjf);
3572 
3573  *upwind_switch = true;
3574 
3575  }
3576 
3577  /* Blending
3578  --------*/
3579 
3580  cs_blend_f_val(blencp,
3581  pi,
3582  pif);
3583  cs_blend_f_val(blencp,
3584  pj,
3585  pjf);
3586 
3587  /* If iconv=0 p*f are useless */
3588  } else {
3590  pif);
3591  cs_upwind_f_val(pj,
3592  pjf);
3593  }
3594 
3595 }
3596 
3597 /*----------------------------------------------------------------------------*/
3608 /*----------------------------------------------------------------------------*/
3609 
3610 inline static void
3612  const cs_lnum_t jj,
3613  const cs_real_t i_massflux,
3614  cs_lnum_t *ic,
3615  cs_lnum_t *id)
3616 {
3617  if (i_massflux >= 0.) {
3618  *ic = ii;
3619  *id = jj;
3620  } else {
3621  *ic = jj;
3622  *id = ii;
3623  }
3624 }
3625 
3626 /*----------------------------------------------------------------------------*/
3647 /*----------------------------------------------------------------------------*/
3648 
3649 inline static void
3651  const double beta,
3652  const cs_real_3_t cell_cen_c,
3653  const cs_real_3_t cell_cen_d,
3654  const cs_real_3_t i_face_normal,
3655  const cs_real_3_t i_face_cog,
3656  const cs_real_3_t gradv_c,
3657  const cs_real_t p_c,
3658  const cs_real_t p_d,
3659  const cs_real_t local_max_c,
3660  const cs_real_t local_min_c,
3661  const cs_real_t courant_c,
3662  cs_real_t *pif,
3663  cs_real_t *pjf)
3664 {
3665  /* distance between face center and central cell center */
3666  cs_real_t dist_fc;
3667  cs_real_3_t nfc;
3668  cs_math_3_length_unitv(cell_cen_c, i_face_cog, &dist_fc, nfc);
3669 
3670  /* unit vector and distance between central and downwind cells centers */
3671  cs_real_t dist_dc;
3672  cs_real_3_t ndc;
3673  cs_math_3_length_unitv(cell_cen_c, cell_cen_d, &dist_dc, ndc);
3674 
3675  /* Place the upwind point on the line that joins
3676  the two cells on the upwind side and the same
3677  distance as that between the two cells */
3678  const cs_real_t dist_cu = dist_dc;
3679  const cs_real_t dist_du = dist_dc + dist_cu;
3680 
3681  /* Compute the property on the upwind assuming a parabolic
3682  variation of the property between the two cells */
3683  const cs_real_t gradc = cs_math_3_dot_product(gradv_c, ndc);
3684 
3685  const cs_real_t grad2c = ((p_d - p_c)/dist_dc - gradc)/dist_dc;
3686 
3687  cs_real_t p_u = p_c + (grad2c*dist_cu - gradc)*dist_cu;
3688  p_u = CS_MAX(CS_MIN(p_u, local_max_c), local_min_c);
3689 
3690  /* Compute the normalised distances */
3691  const cs_real_t nvf_r_f = (dist_fc+dist_cu)/dist_du;
3692  const cs_real_t nvf_r_c = dist_cu/dist_du;
3693 
3694  /* Check for the bounds of the NVD diagram and compute the face
3695  property according to the selected NVD scheme */
3696  const cs_real_t _small = cs_math_epzero
3697  * (CS_ABS(p_u)+CS_ABS(p_c)+CS_ABS(p_d));
3698 
3699  if (CS_ABS(p_d-p_u) <= _small) {
3700  *pif = p_c;
3701  *pjf = p_c;
3702  } else {
3703  const cs_real_t nvf_p_c = (p_c - p_u)/(p_d - p_u);
3704 
3705  if (nvf_p_c <= 0. || nvf_p_c >= 1.) {
3706  *pif = p_c;
3707  *pjf = p_c;
3708  } else {
3709  cs_real_t nvf_p_f;
3710 
3711  /* Highly compressive NVD scheme for VOF */
3712  if (limiter >= CS_NVD_VOF_HRIC) {
3713  nvf_p_f = cs_nvd_vof_scheme_scalar(limiter,
3714  i_face_normal,
3715  nvf_p_c,
3716  nvf_r_f,
3717  nvf_r_c,
3718  gradv_c,
3719  courant_c);
3720  } else { /* Regular NVD scheme */
3721  nvf_p_f = cs_nvd_scheme_scalar(limiter,
3722  nvf_p_c,
3723  nvf_r_f,
3724  nvf_r_c);
3725  }
3726 
3727  *pif = p_u + nvf_p_f*(p_d - p_u);
3728  *pif = CS_MAX(CS_MIN(*pif, local_max_c), local_min_c);
3729 
3731  p_c,
3732  pif);
3733 
3734  *pjf = *pif;
3735  }
3736  }
3737 }
3738 
3739 /*----------------------------------------------------------------------------*/
3774 /*----------------------------------------------------------------------------*/
3775 
3776 inline static void
3778  const int iconvp,
3779  const cs_real_t bldfrp,
3780  const int ischcp,
3781  const double blencp,
3782  const double blend_st,
3783  const cs_real_t weight,
3784  const cs_real_t i_dist,
3785  const cs_real_t i_face_surf,
3786  const cs_real_3_t cell_ceni,
3787  const cs_real_3_t cell_cenj,
3788  const cs_real_3_t i_face_normal,
3789  const cs_real_3_t i_face_cog,
3790  const cs_real_3_t diipf,
3791  const cs_real_3_t djjpf,
3792  const cs_real_t i_massflux,
3793  const cs_real_33_t gradi,
3794  const cs_real_33_t gradj,
3795  const cs_real_33_t grdpai,
3796  const cs_real_33_t grdpaj,
3797  const cs_real_3_t pi,
3798  const cs_real_3_t pj,
3799  cs_real_t pif[3],
3800  cs_real_t pjf[3],
3801  cs_real_t pip[3],
3802  cs_real_t pjp[3])
3803 {
3804  cs_real_t recoi[3], recoj[3];
3805  cs_real_t testij, tesqck;
3806 
3808  diipf,
3809  djjpf,
3810  gradi,
3811  gradj,
3812  pi,
3813  pj,
3814  recoi,
3815  recoj,
3816  pip,
3817  pjp);
3818 
3819  /* Convection slope test is needed only when iconv >0 */
3820  if (iconvp > 0) {
3822  pj,
3823  i_dist,
3824  i_face_surf,
3825  i_face_normal,
3826  gradi,
3827  gradj,
3828  grdpai,
3829  grdpaj,
3830  i_massflux,
3831  &testij,
3832  &tesqck);
3833 
3834  for (int isou = 0; isou < 3; isou++) {
3835  if (ischcp == 1) {
3836 
3837  /* Centered
3838  --------*/
3839 
3840  cs_centered_f_val(weight,
3841  pip[isou],
3842  pjp[isou],
3843  &pif[isou]);
3844  cs_centered_f_val(weight,
3845  pip[isou],
3846  pjp[isou],
3847  &pjf[isou]);
3848 
3849  } else {
3850 
3851  /* Second order
3852  ------------*/
3853 
3854  cs_solu_f_val(cell_ceni,
3855  i_face_cog,
3856  gradi[isou],
3857  pi[isou],
3858  &pif[isou]);
3859  cs_solu_f_val(cell_cenj,
3860  i_face_cog,
3861  gradj[isou],
3862  pj[isou],
3863  &pjf[isou]);
3864 
3865  }
3866 
3867  }
3868 
3869  /* Slope test: Percentage of upwind
3870  ----------------------------------*/
3871 
3872  if (tesqck <= 0. || testij <= 0.) {
3873 
3874  cs_blend_f_val_vector(blend_st,
3875  pi,
3876  pif);
3877  cs_blend_f_val_vector(blend_st,
3878  pj,
3879  pjf);
3880 
3881  *upwind_switch = true;
3882 
3883  }
3884 
3885 
3886  /* Blending
3887  --------*/
3888  cs_blend_f_val_vector(blencp,
3889  pi,
3890  pif);
3891  cs_blend_f_val_vector(blencp,
3892  pj,
3893  pjf);
3894 
3895  /* If iconv=0 p*f are useless */
3896  }
3897  else {
3898 
3899  for (int isou = 0; isou < 3; isou++) {
3900  cs_upwind_f_val(pi[isou],
3901  &pif[isou]);
3902  cs_upwind_f_val(pj[isou],
3903  &pjf[isou]);
3904 
3905  }
3906  }
3907 
3908 }
3909 
3910 /*----------------------------------------------------------------------------*/
3945 /*----------------------------------------------------------------------------*/
3946 
3947 inline static void
3949  const int iconvp,
3950  const cs_real_t bldfrp,
3951  const int ischcp,
3952  const double blencp,
3953  const double blend_st,
3954  const cs_real_t weight,
3955  const cs_real_t i_dist,
3956  const cs_real_t i_face_surf,
3957  const cs_real_3_t cell_ceni,
3958  const cs_real_3_t cell_cenj,
3959  const cs_real_3_t i_face_normal,
3960  const cs_real_3_t i_face_cog,
3961  const cs_real_3_t diipf,
3962  const cs_real_3_t djjpf,
3963  const cs_real_t i_massflux,
3964  const cs_real_63_t gradi,
3965  const cs_real_63_t gradj,
3966  const cs_real_63_t grdpai,
3967  const cs_real_63_t grdpaj,
3968  const cs_real_6_t pi,
3969  const cs_real_6_t pj,
3970  cs_real_t pif[6],
3971  cs_real_t pjf[6],
3972  cs_real_t pip[6],
3973  cs_real_t pjp[6])
3974 {
3975  cs_real_t recoi[6], recoj[6];
3976  cs_real_t testij, tesqck;
3977  int isou;
3978 
3980  diipf,
3981  djjpf,
3982  gradi,
3983  gradj,
3984  pi,
3985  pj,
3986  recoi,
3987  recoj,
3988  pip,
3989  pjp);
3990 
3991  /* Convection slope test is needed only when iconv >0 */
3992  if (iconvp > 0) {
3994  pj,
3995  i_dist,
3996  i_face_surf,
3997  i_face_normal,
3998  gradi,
3999  gradj,
4000  grdpai,
4001  grdpaj,
4002  i_massflux,
4003  &testij,
4004  &tesqck);
4005 
4006  for (isou = 0; isou < 6; isou++) {
4007 
4008  if (ischcp==1) {
4009 
4010  /* Centered
4011  --------*/
4012 
4013  cs_centered_f_val(weight,
4014  pip[isou],
4015  pjp[isou],
4016  &pif[isou]);
4017  cs_centered_f_val(weight,
4018  pip[isou],
4019  pjp[isou],
4020  &pjf[isou]);
4021 
4022  } else {
4023 
4024  /* Second order
4025  ------------*/
4026 
4027  cs_solu_f_val(cell_ceni,
4028  i_face_cog,
4029  gradi[isou],
4030  pi[isou],
4031  &pif[isou]);
4032  cs_solu_f_val(cell_cenj,
4033  i_face_cog,
4034  gradj[isou],
4035  pj[isou],
4036  &pjf[isou]);
4037  }
4038 
4039  }
4040 
4041  /* Slope test activated: poucentage of upwind */
4042  if (tesqck <= 0. || testij <= 0.) {
4043 
4044  /* Upwind
4045  --------*/
4046 
4047  cs_blend_f_val_tensor(blend_st,
4048  pi,
4049  pif);
4050  cs_blend_f_val_tensor(blend_st,
4051  pj,
4052  pjf);
4053 
4054  *upwind_switch = true;
4055  }
4056 
4057 
4058  /* Blending
4059  --------*/
4060 
4061  cs_blend_f_val_tensor(blencp,
4062  pi,
4063  pif);
4064  cs_blend_f_val_tensor(blencp,
4065  pj,
4066  pjf);
4067 
4068  /* If iconv=0 p*fr* are useless */
4069  } else {
4070 
4071  for (isou = 0; isou < 6; isou++) {
4072  cs_upwind_f_val(pi[isou],
4073  &pif[isou]);
4074  cs_upwind_f_val(pj[isou],
4075  &pjf[isou]);
4076  }
4077  }
4078 }
4079 
4080 /*----------------------------------------------------------------------------*/
4089 /*----------------------------------------------------------------------------*/
4090 
4091 inline static void
4093  const cs_real_3_t gradi,
4094  const cs_real_t bldfrp,
4095  cs_real_t *recoi)
4096 {
4097  *recoi = bldfrp * ( gradi[0]*diipb[0]
4098  + gradi[1]*diipb[1]
4099  + gradi[2]*diipb[2]);
4100 }
4101 
4102 /*----------------------------------------------------------------------------*/
4111 /*----------------------------------------------------------------------------*/
4112 
4113 inline static void
4115  const cs_real_33_t gradi,
4116  const cs_real_t bldfrp,
4117  cs_real_t recoi[3])
4118 {
4119  for (int isou = 0; isou < 3; isou++) {
4120  recoi[isou] = bldfrp * ( gradi[isou][0]*diipb[0]
4121  + gradi[isou][1]*diipb[1]
4122  + gradi[isou][2]*diipb[2]);
4123  }
4124 }
4125 
4126 /*----------------------------------------------------------------------------*/
4135 /*----------------------------------------------------------------------------*/
4136 
4137 inline static void
4139  const cs_real_63_t gradi,
4140  const cs_real_t bldfrp,
4141  cs_real_t recoi[6])
4142 {
4143  for (int isou = 0; isou < 6; isou++) {
4144  recoi[isou] = bldfrp * ( gradi[isou][0]*diipb[0]
4145  + gradi[isou][1]*diipb[1]
4146  + gradi[isou][2]*diipb[2]);
4147  }
4148 }
4149 
4150 /*----------------------------------------------------------------------------*/
4161 /*----------------------------------------------------------------------------*/
4162 
4163 inline static void
4164 cs_b_relax_c_val(const double relaxp,
4165  const cs_real_t pi,
4166  const cs_real_t pia,
4167  const cs_real_t recoi,
4168  cs_real_t *pir,
4169  cs_real_t *pipr)
4170 {
4171  *pir = pi/relaxp - (1.-relaxp)/relaxp*pia;
4172  *pipr = *pir + recoi;
4173 }
4174 
4175 /*----------------------------------------------------------------------------*/
4186 /*----------------------------------------------------------------------------*/
4187 
4188 inline static void
4189 cs_b_relax_c_val_vector(const double relaxp,
4190  const cs_real_3_t pi,
4191  const cs_real_3_t pia,
4192  const cs_real_3_t recoi,
4193  cs_real_t pir[3],
4194  cs_real_t pipr[3])
4195 {
4196  for (int isou = 0; isou < 3; isou++) {
4197  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4198  pipr[isou] = pir[isou] + recoi[isou];
4199  }
4200 }
4201 
4202 /*----------------------------------------------------------------------------*/
4213 /*----------------------------------------------------------------------------*/
4214 
4215 inline static void
4216 cs_b_relax_c_val_tensor(const double relaxp,
4217  const cs_real_6_t pi,
4218  const cs_real_6_t pia,
4219  const cs_real_6_t recoi,
4220  cs_real_t pir[6],
4221  cs_real_t pipr[6])
4222 {
4223  for (int isou = 0; isou < 6; isou++) {
4224  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4225  pipr[isou] = pir[isou] + recoi[isou];
4226  }
4227 }
4228 
4229 /*----------------------------------------------------------------------------*/
4253 /*----------------------------------------------------------------------------*/
4254 
4255 inline static void
4257  cs_real_t thetap,
4258  int imasac,
4259  int inc,
4260  int bc_type,
4261  int icvfli,
4262  cs_real_t pi,
4263  cs_real_t pir,
4264  cs_real_t pipr,
4265  cs_real_t coefap,
4266  cs_real_t coefbp,
4267  cs_real_t coface,
4268  cs_real_t cofbce,
4269  cs_real_t b_massflux,
4270  cs_real_t xcpp,
4271  cs_real_t *flux)
4272 {
4273  cs_real_t flui, fluj, pfac;
4274 
4275  /* Computed convective flux */
4276 
4277  if (icvfli == 0) {
4278 
4279  /* Remove decentering for coupled faces */
4280  if (bc_type == CS_COUPLED_FD) {
4281  flui = 0.0;
4282  fluj = b_massflux;
4283  } else {
4284  flui = 0.5*(b_massflux +fabs(b_massflux));
4285  fluj = 0.5*(b_massflux -fabs(b_massflux));
4286  }
4287 
4288  pfac = inc*coefap + coefbp*pipr;
4289  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4290 
4291  /* Imposed convective flux */
4292 
4293  } else {
4294 
4295  pfac = inc*coface + cofbce*pipr;
4296  *flux += iconvp*xcpp*(-imasac*(b_massflux*pi) + thetap*(pfac));
4297 
4298  }
4299 }
4300 
4301 /*----------------------------------------------------------------------------*/
4323 /*----------------------------------------------------------------------------*/
4324 
4325 inline static void
4327  cs_real_t thetap,
4328  int imasac,
4329  int inc,
4330  int bc_type,
4331  int icvfli,
4332  const cs_real_t pi[restrict 3],
4333  const cs_real_t pir[restrict 3],
4334  const cs_real_t pipr[restrict 3],
4335  const cs_real_t coefap[restrict 3],
4336  const cs_real_t coefbp[restrict 3][3],
4337  const cs_real_t coface[restrict 3],
4338  const cs_real_t cofbce[restrict 3][3],
4339  cs_real_t b_massflux,
4340  cs_real_t pfac[3],
4341  cs_real_t flux[restrict 3])
4342 {
4343  cs_real_t flui, fluj;
4344 
4345  /* Computed convective flux */
4346 
4347  if (icvfli == 0) {
4348 
4349  /* Remove decentering for coupled faces */
4350  if (bc_type == CS_COUPLED_FD) {
4351  flui = 0.0;
4352  fluj = b_massflux;
4353  } else {
4354  flui = 0.5*(b_massflux +fabs(b_massflux));
4355  fluj = 0.5*(b_massflux -fabs(b_massflux));
4356  }
4357  for (int isou = 0; isou < 3; isou++) {
4358  pfac[isou] = inc*coefap[isou];
4359  for (int jsou = 0; jsou < 3; jsou++) {
4360  pfac[isou] += coefbp[isou][jsou]*pipr[jsou];
4361  }
4362  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac[isou])
4363  - imasac*b_massflux*pi[isou]);
4364  }
4365 
4366  /* Imposed convective flux */
4367 
4368  } else {
4369 
4370  for (int isou = 0; isou < 3; isou++) {
4371  pfac[isou] = inc*coface[isou];
4372  for (int jsou = 0; jsou < 3; jsou++) {
4373  pfac[isou] += cofbce[isou][jsou]*pipr[jsou];
4374  }
4375  flux[isou] += iconvp*( thetap*pfac[isou]
4376  - imasac*b_massflux*pi[isou]);
4377  }
4378 
4379  }
4380 }
4381 
4382 /*----------------------------------------------------------------------------*/
4402 /*----------------------------------------------------------------------------*/
4403 
4404 inline static void
4405 cs_b_upwind_flux(const int iconvp,
4406  const cs_real_t thetap,
4407  const int imasac,
4408  const int inc,
4409  const int bc_type,
4410  const cs_real_t pi,
4411  const cs_real_t pir,
4412  const cs_real_t pipr,
4413  const cs_real_t coefap,
4414  const cs_real_t coefbp,
4415  const cs_real_t b_massflux,
4416  const cs_real_t xcpp,
4417  cs_real_t *flux)
4418 {
4419  cs_real_t flui, fluj, pfac;
4420 
4421  /* Remove decentering for coupled faces */
4422  if (bc_type == CS_COUPLED_FD) {
4423  flui = 0.0;
4424  fluj = b_massflux;
4425  } else {
4426  flui = 0.5*(b_massflux +fabs(b_massflux));
4427  fluj = 0.5*(b_massflux -fabs(b_massflux));
4428  }
4429 
4430  pfac = inc*coefap + coefbp*pipr;
4431  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4432 }
4433 
4434 /*----------------------------------------------------------------------------*/
4454 /*----------------------------------------------------------------------------*/
4455 
4456 inline static void
4457 cs_b_upwind_flux_vector(const int iconvp,
4458  const cs_real_t thetap,
4459  const int imasac,
4460  const int inc,
4461  const int bc_type,
4462  const cs_real_3_t pi,
4463  const cs_real_3_t pir,
4464  const cs_real_3_t pipr,
4465  const cs_real_3_t coefa,
4466  const cs_real_33_t coefb,
4467  const cs_real_t b_massflux,
4468  cs_real_t pfac[3],
4469  cs_real_t flux[3])
4470 {
4471  cs_real_t flui, fluj;
4472 
4473  /* Remove decentering for coupled faces */
4474  if (bc_type == CS_COUPLED_FD) {
4475  flui = 0.0;
4476  fluj = b_massflux;
4477  } else {
4478  flui = 0.5*(b_massflux +fabs(b_massflux));
4479  fluj = 0.5*(b_massflux -fabs(b_massflux));
4480  }
4481  for (int isou = 0; isou < 3; isou++) {
4482  pfac[isou] = inc*coefa[isou];
4483  for (int jsou = 0; jsou < 3; jsou++) {
4484  pfac[isou] += coefb[isou][jsou]*pipr[jsou];
4485  }
4486  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac[isou])
4487  - imasac*b_massflux*pi[isou]);
4488  }
4489 }
4490 
4491 /*----------------------------------------------------------------------------*/
4511 /*----------------------------------------------------------------------------*/
4512 
4513 inline static void
4514 cs_b_upwind_flux_tensor(const int iconvp,
4515  const cs_real_t thetap,
4516  const int imasac,
4517  const int inc,
4518  const int bc_type,
4519  const cs_real_6_t pi,
4520  const cs_real_6_t pir,
4521  const cs_real_6_t pipr,
4522  const cs_real_6_t coefa,
4523  const cs_real_66_t coefb,
4524  const cs_real_t b_massflux,
4525  cs_real_t flux[6])
4526 {
4527  cs_real_t flui, fluj, pfac;
4528 
4529  /* Remove decentering for coupled faces */
4530  if (bc_type == CS_COUPLED_FD) {
4531  flui = 0.0;
4532  fluj = b_massflux;
4533  } else {
4534  flui = 0.5*(b_massflux +fabs(b_massflux));
4535  fluj = 0.5*(b_massflux -fabs(b_massflux));
4536  }
4537  for (int isou = 0; isou < 6; isou++) {
4538  pfac = inc*coefa[isou];
4539  for (int jsou = 0; jsou < 6; jsou++) {
4540  pfac += coefb[isou][jsou]*pipr[jsou];
4541  }
4542  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4543  - imasac*b_massflux*pi[isou]);
4544  }
4545 }
4546 
4547 /*----------------------------------------------------------------------------*/
4560 /*----------------------------------------------------------------------------*/
4561 
4562 inline static void
4563 cs_b_diff_flux(const int idiffp,
4564  const cs_real_t thetap,
4565  const int inc,
4566  const cs_real_t pipr,
4567  const cs_real_t cofafp,
4568  const cs_real_t cofbfp,
4569  const cs_real_t b_visc,
4570  cs_real_t *flux)
4571 {
4572  cs_real_t pfacd = inc*cofafp + cofbfp*pipr;
4573  *flux += idiffp*thetap*b_visc*pfacd;
4574 }
4575 
4576 /*----------------------------------------------------------------------------*/
4589 /*----------------------------------------------------------------------------*/
4590 
4591 inline static void
4592 cs_b_diff_flux_vector(const int idiffp,
4593  const cs_real_t thetap,
4594  const int inc,
4595  const cs_real_3_t pipr,
4596  const cs_real_3_t cofaf,
4597  const cs_real_33_t cofbf,
4598  const cs_real_t b_visc,
4599  cs_real_t flux[3])
4600 {
4601  cs_real_t pfacd ;
4602  for (int isou = 0; isou < 3; isou++) {
4603  pfacd = inc*cofaf[isou];
4604  for (int jsou = 0; jsou < 3; jsou++) {
4605  pfacd += cofbf[isou][jsou]*pipr[jsou];
4606  }
4607  flux[isou] += idiffp*thetap*b_visc*pfacd;
4608  }
4609 }
4610 
4611 /*----------------------------------------------------------------------------*/
4624 /*----------------------------------------------------------------------------*/
4625 
4626 inline static void
4627 cs_b_diff_flux_tensor(const int idiffp,
4628  const cs_real_t thetap,
4629  const int inc,
4630  const cs_real_6_t pipr,
4631  const cs_real_6_t cofaf,
4632  const cs_real_66_t cofbf,
4633  const cs_real_t b_visc,
4634  cs_real_t flux[6])
4635 {
4636  cs_real_t pfacd ;
4637  for (int isou = 0; isou < 6; isou++) {
4638  pfacd = inc*cofaf[isou];
4639  for (int jsou = 0; jsou < 6; jsou++) {
4640  pfacd += cofbf[isou][jsou]*pipr[jsou];
4641  }
4642  flux[isou] += idiffp*thetap*b_visc*pfacd;
4643  }
4644 }
4645 
4646 /*----------------------------------------------------------------------------*/
4660 /*----------------------------------------------------------------------------*/
4661 
4662 inline static void
4664  const double relaxp,
4665  const cs_real_3_t diipb,
4666  const cs_real_3_t gradi,
4667  const cs_real_t pi,
4668  const cs_real_t pia,
4669  cs_real_t *pir,
4670  cs_real_t *pipr)
4671 {
4672  cs_real_t recoi;
4673 
4675  gradi,
4676  bldfrp,
4677  &recoi);
4678 
4679  cs_b_relax_c_val(relaxp,
4680  pi,
4681  pia,
4682  recoi,
4683  pir,
4684  pipr);
4685 }
4686 
4687 /*----------------------------------------------------------------------------*/
4701 /*----------------------------------------------------------------------------*/
4702 
4703 inline static void
4705  const double relaxp,
4706  const cs_real_3_t diipb,
4707  const cs_real_33_t gradi,
4708  const cs_real_3_t pi,
4709  const cs_real_3_t pia,
4710  cs_real_t pir[3],
4711  cs_real_t pipr[3])
4712 {
4713  cs_real_3_t recoi;
4714 
4716  gradi,
4717  bldfrp,
4718  recoi);
4719 
4720  cs_b_relax_c_val_vector(relaxp,
4721  pi,
4722  pia,
4723  recoi,
4724  pir,
4725  pipr);
4726 }
4727 
4728 /*----------------------------------------------------------------------------*/
4742 /*----------------------------------------------------------------------------*/
4743 
4744 inline static void
4746  const double relaxp,
4747  const cs_real_3_t diipb,
4748  const cs_real_63_t gradi,
4749  const cs_real_6_t pi,
4750  const cs_real_6_t pia,
4751  cs_real_t pir[6],
4752  cs_real_t pipr[6])
4753 {
4754  cs_real_6_t recoi;
4755 
4757  gradi,
4758  bldfrp,
4759  recoi);
4760 
4761  cs_b_relax_c_val_tensor(relaxp,
4762  pi,
4763  pia,
4764  recoi,
4765  pir,
4766  pipr);
4767 }
4768 
4769 /*----------------------------------------------------------------------------*/
4780 /*----------------------------------------------------------------------------*/
4781 
4782 inline static void
4784  const cs_real_3_t diipb,
4785  const cs_real_3_t gradi,
4786  const cs_real_t pi,
4787  cs_real_t *pip)
4788 {
4789  cs_real_t recoi;
4790 
4792  gradi,
4793  bldfrp,
4794  &recoi);
4795 
4796  *pip = pi + recoi;
4797 }
4798 
4799 /*----------------------------------------------------------------------------*/
4810 /*----------------------------------------------------------------------------*/
4811 
4812 inline static void
4814  const cs_real_3_t diipb,
4815  const cs_real_33_t gradi,
4816  const cs_real_3_t pi,
4817  cs_real_t pip[3])
4818 {
4819  cs_real_3_t recoi;
4820 
4822  gradi,
4823  bldfrp,
4824  recoi);
4825 
4826  for (int isou = 0; isou < 3; isou++)
4827  pip[isou] = pi[isou] + recoi[isou];
4828 }
4829 
4830 /*----------------------------------------------------------------------------*/
4841 /*----------------------------------------------------------------------------*/
4842 
4843 inline static void
4845  const cs_real_3_t diipb,
4846  const cs_real_63_t gradi,
4847  const cs_real_6_t pi,
4848  cs_real_t pip[6])
4849 {
4850  cs_real_6_t recoi;
4851 
4853  gradi,
4854  bldfrp,
4855  recoi);
4856 
4857  for(int isou = 0; isou< 6; isou++)
4858  pip[isou] = pi[isou] + recoi[isou];
4859 }
4860 
4861 /*----------------------------------------------------------------------------*/
4872 /*----------------------------------------------------------------------------*/
4873 
4874 inline static void
4876  cs_real_t pi,
4877  cs_real_t pj,
4878  cs_real_t b_visc,
4879  cs_real_t *fluxi)
4880 {
4881  *fluxi += idiffp*b_visc*(pi - pj);
4882 }
4883 
4884 /*----------------------------------------------------------------------------*/
4895 /*----------------------------------------------------------------------------*/
4896 
4897 inline static void
4899  const cs_real_t pi[3],
4900  const cs_real_t pj[3],
4901  cs_real_t b_visc,
4902  cs_real_t fluxi[3])
4903 {
4904  for (int k = 0; k < 3; k++)
4905  fluxi[k] += idiffp*b_visc*(pi[k] - pj[k]);
4906 }
4907 
4908 
4909 /*============================================================================
4910  * Public function prototypes for Fortran API
4911  *============================================================================*/
4912 
4913 /*----------------------------------------------------------------------------
4914  * Wrapper to cs_face_diffusion_potential
4915  *----------------------------------------------------------------------------*/
4916 
4917 void CS_PROCF (itrmas, ITRMAS)
4918 (
4919  const int *const f_id,
4920  const int *const init,
4921  const int *const inc,
4922  const int *const imrgra,
4923  const int *const nswrgp,
4924  const int *const imligp,
4925  const int *const iphydp,
4926  const int *const iwgrp,
4927  const int *const iwarnp,
4928  const cs_real_t *const epsrgp,
4929  const cs_real_t *const climgp,
4930  const cs_real_t *const extrap,
4931  cs_real_3_t frcxt[],
4932  cs_real_t pvar[],
4933  const cs_real_t coefap[],
4934  const cs_real_t coefbp[],
4935  const cs_real_t cofafp[],
4936  const cs_real_t cofbfp[],
4937  const cs_real_t i_visc[],
4938  const cs_real_t b_visc[],
4939  cs_real_t visel[],
4940  cs_real_t i_massflux[],
4941  cs_real_t b_massflux[]
4942 );
4943 
4944 /*----------------------------------------------------------------------------
4945  * Wrapper to cs_face_anisotropic_diffusion_potential
4946  *----------------------------------------------------------------------------*/
4947 
4948 void CS_PROCF (itrmav, ITRMAV)
4949 (
4950  const int *const f_id,
4951  const int *const init,
4952  const int *const inc,
4953  const int *const imrgra,
4954  const int *const nswrgp,
4955  const int *const imligp,
4956  const int *const ircflp,
4957  const int *const iphydp,
4958  const int *const iwgrp,
4959  const int *const iwarnp,
4960  const cs_real_t *const epsrgp,
4961  const cs_real_t *const climgp,
4962  const cs_real_t *const extrap,
4963  cs_real_3_t frcxt[],
4964  cs_real_t pvar[],
4965  const cs_real_t coefap[],
4966  const cs_real_t coefbp[],
4967  const cs_real_t cofafp[],
4968  const cs_real_t cofbfp[],
4969  const cs_real_t i_visc[],
4970  const cs_real_t b_visc[],
4971  cs_real_6_t viscel[],
4972  const cs_real_2_t weighf[],
4973  const cs_real_t weighb[],
4974  cs_real_t i_massflux[],
4975  cs_real_t b_massflux[]
4976 );
4977 
4978 /*=============================================================================
4979  * Public function prototypes
4980  *============================================================================*/
4981 
4982 /*----------------------------------------------------------------------------
4983  * Compute the local cell Courant number as the maximum of all cell face based
4984  * Courant number at each cell.
4985  *
4986  * parameters:
4987  * f_id <-- field id (or -1)
4988  * courant --> cell Courant number
4989  */
4990 /*----------------------------------------------------------------------------*/
4991 
4992 void
4993 cs_cell_courant_number(const int f_id,
4994  cs_real_t *courant);
4995 
4996 /*----------------------------------------------------------------------------
4997  * Return pointer to slope test indicator field values if active.
4998  *
4999  * parameters:
5000  * f_id <-- field id (or -1)
5001  * var_cal_opt <-- variable calculation options
5002  *
5003  * return:
5004  * pointer to local values array, or NULL;
5005  *----------------------------------------------------------------------------*/
5006 
5007 cs_real_t *
5008 cs_get_v_slope_test(int f_id,
5010 
5011 /*----------------------------------------------------------------------------*/
5030 /*----------------------------------------------------------------------------*/
5031 
5032 void
5033 cs_slope_test_gradient(int f_id,
5034  int inc,
5035  cs_halo_type_t halo_type,
5036  const cs_real_3_t *grad,
5037  cs_real_3_t *grdpa,
5038  const cs_real_t *pvar,
5039  const cs_real_t *coefap,
5040  const cs_real_t *coefbp,
5041  const cs_real_t *i_massflux);
5042 
5043 /*----------------------------------------------------------------------------*/
5059 /*----------------------------------------------------------------------------*/
5060 
5061 void
5062 cs_upwind_gradient(const int f_id,
5063  const int inc,
5064  const cs_halo_type_t halo_type,
5065  const cs_real_t coefap[],
5066  const cs_real_t coefbp[],
5067  const cs_real_t i_massflux[],
5068  const cs_real_t b_massflux[],
5069  const cs_real_t *restrict pvar,
5070  cs_real_3_t *restrict grdpa);
5071 
5072 /*----------------------------------------------------------------------------*/
5090 /*----------------------------------------------------------------------------*/
5091 
5092 void
5093 cs_slope_test_gradient_vector(const int inc,
5094  const cs_halo_type_t halo_type,
5095  const cs_real_33_t *grad,
5096  cs_real_33_t *grdpa,
5097  const cs_real_3_t *pvar,
5098  const cs_real_3_t *coefa,
5099  const cs_real_33_t *coefb,
5100  const cs_real_t *i_massflux);
5101 
5102 /*----------------------------------------------------------------------------*/
5120 /*----------------------------------------------------------------------------*/
5121 
5122 void
5123 cs_slope_test_gradient_tensor(const int inc,
5124  const cs_halo_type_t halo_type,
5125  const cs_real_63_t *grad,
5126  cs_real_63_t *grdpa,
5127  const cs_real_6_t *pvar,
5128  const cs_real_6_t *coefa,
5129  const cs_real_66_t *coefb,
5130  const cs_real_t *i_massflux);
5131 
5132 /*----------------------------------------------------------------------------*/
5141 /*----------------------------------------------------------------------------*/
5142 
5143 void
5144 cs_beta_limiter_building(int f_id,
5145  int inc,
5146  const cs_real_t rovsdt[]);
5147 
5148 /*----------------------------------------------------------------------------*/
5200 /*----------------------------------------------------------------------------*/
5201 
5202 void
5204  int f_id,
5206  int icvflb,
5207  int inc,
5208  int imasac,
5209  cs_real_t *restrict pvar,
5210  const cs_real_t *restrict pvara,
5211  const int icvfli[],
5212  const cs_real_t coefap[],
5213  const cs_real_t coefbp[],
5214  const cs_real_t cofafp[],
5215  const cs_real_t cofbfp[],
5216  const cs_real_t i_massflux[],
5217  const cs_real_t b_massflux[],
5218  const cs_real_t i_visc[],
5219  const cs_real_t b_visc[],
5220  cs_real_t *restrict rhs);
5221 
5222 /*----------------------------------------------------------------------------*/
5257 /*----------------------------------------------------------------------------*/
5258 
5259 void
5261  int f_id,
5263  int icvflb,
5264  int inc,
5265  int imasac,
5266  cs_real_t *restrict pvar,
5267  const cs_real_t *restrict pvara,
5268  const int icvfli[],
5269  const cs_real_t coefap[],
5270  const cs_real_t coefbp[],
5271  const cs_real_t i_massflux[],
5272  const cs_real_t b_massflux[],
5273  cs_real_2_t i_conv_flux[],
5274  cs_real_t b_conv_flux[]);
5275 
5276 /*----------------------------------------------------------------------------*/
5338 /*----------------------------------------------------------------------------*/
5339 
5340 void
5342  int f_id,
5344  int icvflb,
5345  int inc,
5346  int ivisep,
5347  int imasac,
5348  cs_real_3_t *restrict pvar,
5349  const cs_real_3_t *restrict pvara,
5350  const int icvfli[],
5351  const cs_real_3_t coefav[],
5352  const cs_real_33_t coefbv[],
5353  const cs_real_3_t cofafv[],
5354  const cs_real_33_t cofbfv[],
5355  const cs_real_t i_massflux[],
5356  const cs_real_t b_massflux[],
5357  const cs_real_t i_visc[],
5358  const cs_real_t b_visc[],
5359  const cs_real_t i_secvis[],
5360  const cs_real_t b_secvis[],
5361  cs_real_3_t *restrict i_pvar,
5362  cs_real_3_t *restrict b_pvar,
5363  cs_real_3_t *restrict rhs);
5364 
5365 /*----------------------------------------------------------------------------*/
5410 /*----------------------------------------------------------------------------*/
5411 
5412 void
5414  int f_id,
5416  int icvflb,
5417  int inc,
5418  int imasac,
5419  cs_real_6_t *restrict pvar,
5420  const cs_real_6_t *restrict pvara,
5421  const cs_real_6_t coefa[],
5422  const cs_real_66_t coefb[],
5423  const cs_real_6_t cofaf[],
5424  const cs_real_66_t cofbf[],
5425  const cs_real_t i_massflux[],
5426  const cs_real_t b_massflux[],
5427  const cs_real_t i_visc[],
5428  const cs_real_t b_visc[],
5429  cs_real_6_t *restrict rhs);
5430 
5431 /*----------------------------------------------------------------------------*/
5473 /*----------------------------------------------------------------------------*/
5474 
5475 void
5477  int f_id,
5479  int inc,
5480  int imasac,
5481  cs_real_t *restrict pvar,
5482  const cs_real_t *restrict pvara,
5483  const cs_real_t coefap[],
5484  const cs_real_t coefbp[],
5485  const cs_real_t cofafp[],
5486  const cs_real_t cofbfp[],
5487  const cs_real_t i_massflux[],
5488  const cs_real_t b_massflux[],
5489  const cs_real_t i_visc[],
5490  const cs_real_t b_visc[],
5491  const cs_real_t xcpp[],
5492  cs_real_t *restrict rhs);
5493 
5494 /*----------------------------------------------------------------------------*/
5538 /*----------------------------------------------------------------------------*/
5539 
5540 void
5542  int f_id,
5544  int inc,
5545  cs_real_t *restrict pvar,
5546  const cs_real_t *restrict pvara,
5547  const cs_real_t coefap[],
5548  const cs_real_t coefbp[],
5549  const cs_real_t cofafp[],
5550  const cs_real_t cofbfp[],
5551  const cs_real_t i_visc[],
5552  const cs_real_t b_visc[],
5553  cs_real_6_t *restrict viscel,
5554  const cs_real_2_t weighf[],
5555  const cs_real_t weighb[],
5556  cs_real_t *restrict rhs);
5557 
5558 /*-----------------------------------------------------------------------------*/
5608 /*----------------------------------------------------------------------------*/
5609 
5610 void
5612  int f_id,
5614  int inc,
5615  int ivisep,
5616  cs_real_3_t *restrict pvar,
5617  const cs_real_3_t *restrict pvara,
5618  const cs_real_3_t coefav[],
5619  const cs_real_33_t coefbv[],
5620  const cs_real_3_t cofafv[],
5621  const cs_real_33_t cofbfv[],
5622  const cs_real_33_t i_visc[],
5623  const cs_real_t b_visc[],
5624  const cs_real_t i_secvis[],
5625  cs_real_3_t *restrict rhs);
5626 
5627 /*-----------------------------------------------------------------------------*/
5672 /*----------------------------------------------------------------------------*/
5673 
5674 void
5676  int f_id,
5678  int inc,
5679  cs_real_3_t *restrict pvar,
5680  const cs_real_3_t *restrict pvara,
5681  const cs_real_3_t coefav[],
5682  const cs_real_33_t coefbv[],
5683  const cs_real_3_t cofafv[],
5684  const cs_real_33_t cofbfv[],
5685  const cs_real_t i_visc[],
5686  const cs_real_t b_visc[],
5687  cs_real_6_t *restrict viscel,
5688  const cs_real_2_t weighf[],
5689  const cs_real_t weighb[],
5690  cs_real_3_t *restrict rhs);
5691 
5692 /*----------------------------------------------------------------------------*/
5736 /*----------------------------------------------------------------------------*/
5737 
5738 void
5740  int f_id,
5742  int inc,
5743  cs_real_6_t *restrict pvar,
5744  const cs_real_6_t *restrict pvara,
5745  const cs_real_6_t coefa[],
5746  const cs_real_66_t coefb[],
5747  const cs_real_6_t cofaf[],
5748  const cs_real_66_t cofbf[],
5749  const cs_real_t i_visc[],
5750  const cs_real_t b_visc[],
5751  cs_real_6_t *restrict viscel,
5752  const cs_real_2_t weighf[],
5753  const cs_real_t weighb[],
5754  cs_real_6_t *restrict rhs);
5755 
5756 /*----------------------------------------------------------------------------*/
5815 /*----------------------------------------------------------------------------*/
5816 
5817 void
5818 cs_face_diffusion_potential(const int f_id,
5819  const cs_mesh_t *m,
5820  cs_mesh_quantities_t *fvq,
5821  int init,
5822  int inc,
5823  int imrgra,
5824  int nswrgp,
5825  int imligp,
5826  int iphydp,
5827  int iwgrp,
5828  int iwarnp,
5829  double epsrgp,
5830  double climgp,
5831  cs_real_3_t *restrict frcxt,
5832  cs_real_t *restrict pvar,
5833  const cs_real_t coefap[],
5834  const cs_real_t coefbp[],
5835  const cs_real_t cofafp[],
5836  const cs_real_t cofbfp[],
5837  const cs_real_t i_visc[],
5838  const cs_real_t b_visc[],
5839  cs_real_t *restrict visel,
5840  cs_real_t *restrict i_massflux,
5841  cs_real_t *restrict b_massflux);
5842 
5843 /*----------------------------------------------------------------------------*/
5909 /*----------------------------------------------------------------------------*/
5910 
5911 void
5913  const cs_mesh_t *m,
5914  cs_mesh_quantities_t *fvq,
5915  int init,
5916  int inc,
5917  int imrgra,
5918  int nswrgp,
5919  int imligp,
5920  int ircflp,
5921  int iphydp,
5922  int iwgrp,
5923  int iwarnp,
5924  double epsrgp,
5925  double climgp,
5926  cs_real_3_t *restrict frcxt,
5927  cs_real_t *restrict pvar,
5928  const cs_real_t coefap[],
5929  const cs_real_t coefbp[],
5930  const cs_real_t cofafp[],
5931  const cs_real_t cofbfp[],
5932  const cs_real_t i_visc[],
5933  const cs_real_t b_visc[],
5934  cs_real_6_t *restrict viscel,
5935  const cs_real_2_t weighf[],
5936  const cs_real_t weighb[],
5937  cs_real_t *restrict i_massflux,
5938  cs_real_t *restrict b_massflux);
5939 
5940 /*----------------------------------------------------------------------------*/
5994 /*----------------------------------------------------------------------------*/
5995 
5996 void
5997 cs_diffusion_potential(const int f_id,
5998  const cs_mesh_t *m,
5999  cs_mesh_quantities_t *fvq,
6000  int init,
6001  int inc,
6002  int imrgra,
6003  int nswrgp,
6004  int imligp,
6005  int iphydp,
6006  int iwgrp,
6007  int iwarnp,
6008  double epsrgp,
6009  double climgp,
6010  cs_real_3_t *restrict frcxt,
6011  cs_real_t *restrict pvar,
6012  const cs_real_t coefap[],
6013  const cs_real_t coefbp[],
6014  const cs_real_t cofafp[],
6015  const cs_real_t cofbfp[],
6016  const cs_real_t i_visc[],
6017  const cs_real_t b_visc[],
6018  cs_real_t visel[],
6019  cs_real_t *restrict diverg);
6020 
6021 /*----------------------------------------------------------------------------*/
6088 /*----------------------------------------------------------------------------*/
6089 
6090 void
6091 cs_anisotropic_diffusion_potential(const int f_id,
6092  const cs_mesh_t *m,
6093  cs_mesh_quantities_t *fvq,
6094  int init,
6095  int inc,
6096  int imrgra,
6097  int nswrgp,
6098  int imligp,
6099  int ircflp,
6100  int iphydp,
6101  int iwgrp,
6102  int iwarnp,
6103  double epsrgp,
6104  double climgp,
6105  cs_real_3_t *restrict frcxt,
6106  cs_real_t *restrict pvar,
6107  const cs_real_t coefap[],
6108  const cs_real_t coefbp[],
6109  const cs_real_t cofafp[],
6110  const cs_real_t cofbfp[],
6111  const cs_real_t i_visc[],
6112  const cs_real_t b_visc[],
6113  cs_real_6_t *restrict viscel,
6114  const cs_real_2_t weighf[],
6115  const cs_real_t weighb[],
6116  cs_real_t *restrict diverg);
6117 
6118 /*----------------------------------------------------------------------------*/
6119 
6121 
6122 #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:4256
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:8986
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:669
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:3650
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 i_pvar, cs_real_3_t *restrict b_pvar, 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:4154
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_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:4216
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:3611
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:1304
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:4627
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:4783
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:4563
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:607
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:4405
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:4663
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:2739
void cs_cell_courant_number(const int f_id, cs_real_t *courant)
Definition: cs_convection_diffusion.c:747
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:4704
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:833
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:2473
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:11195
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:8233
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:10858
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:4189
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:4844
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 pfac[3], cs_real_t flux[3])
Add convective flux (substracting the mass accumulation from it) to flux at boundary face....
Definition: cs_convection_diffusion.h:4457
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_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 pfac[3], 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:4326
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:4164
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:4745
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:4875
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:4138
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:4114
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:9535
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:4514
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:12036
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:4092
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:3032
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:1591
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:4813
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:5920
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:3224
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:1152
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:3777
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:4898
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:11671
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:3450
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:2994
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:3948
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:892
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:1447
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:4592
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:6888
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:10249
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:2615
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:1031
#define restrict
Definition: cs_defs.h:139
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define CS_MIN(a, b)
Definition: cs_defs.h:477
#define CS_ABS(a)
Definition: cs_defs.h:476
#define CS_MAX(a, b)
Definition: cs_defs.h:478
#define CS_PROCF(x, y)
Definition: cs_defs.h:528
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:344
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:334
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:333
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:336
#define CS_UNUSED(x)
Definition: cs_defs.h:500
#define END_C_DECLS
Definition: cs_defs.h:515
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:343
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:351
@ 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:1951
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:349
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:440
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:456
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:371
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, target 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:168
integer(c_int), pointer, save idtvar
option for a variable time step
Definition: optcal.f90:260
double precision, save fmin
Definition: coincl.f90:184
double precision, dimension(ncharm), save beta
Definition: cpincl.f90:96
double precision, dimension(ncharm), save b1
Definition: cpincl.f90:235
double precision, dimension(ncharm), save b2
Definition: cpincl.f90:235
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