My Project
programmer's documentation
Loading...
Searching...
No Matches
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-2019 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30#include "cs_defs.h"
31
32/*----------------------------------------------------------------------------
33 * Local headers
34 *----------------------------------------------------------------------------*/
35
36#include "cs_base.h"
37#include "cs_halo.h"
38#include "cs_math.h"
39#include "cs_mesh_quantities.h"
40#include "cs_parameters.h"
41
42/*----------------------------------------------------------------------------*/
43
45
46/*=============================================================================
47 * Macro definitions
48 *============================================================================*/
49
56/*
57 * Field property type
58 */
59
61#define CS_ISOTROPIC_DIFFUSION (1 << 0)
62
64#define CS_ORTHOTROPIC_DIFFUSION (1 << 1)
65
67#define CS_ANISOTROPIC_LEFT_DIFFUSION (1 << 2)
68
70#define CS_ANISOTROPIC_RIGHT_DIFFUSION (1 << 3)
71
73#define CS_ANISOTROPIC_DIFFUSION ((1 << 2) + (1 << 3))
74
77/*============================================================================
78 * Type definition
79 *============================================================================*/
80
81/*----------------------------------------------------------------------------
82 * NVD/TVD Advection Scheme
83 *----------------------------------------------------------------------------*/
84
85typedef enum {
86
87 CS_NVD_GAMMA = 0, /* GAMMA */
88 CS_NVD_SMART = 1, /* SMART */
89 CS_NVD_CUBISTA = 2, /* CUBISTA */
90 CS_NVD_SUPERBEE = 3, /* SUPERBEE */
91 CS_NVD_MUSCL = 4, /* MUSCL */
92 CS_NVD_MINMOD = 5, /* MINMOD */
93 CS_NVD_CLAM = 6, /* CLAM */
94 CS_NVD_STOIC = 7, /* STOIC */
95 CS_NVD_OSHER = 8, /* OSHER */
96 CS_NVD_WASEB = 9, /* WASEB */
97 CS_NVD_VOF_HRIC = 10, /* M-HRIC for VOF */
98 CS_NVD_VOF_CICSAM = 11, /* M-CICSAM for VOF */
99 CS_NVD_VOF_STACS = 12, /* STACS for VOF */
100 CS_NVD_N_TYPES = 13 /* number of NVD schemes */
101
103
104/*============================================================================
105 * Global variables
106 *============================================================================*/
107
108/*============================================================================
109 * Public inlined function
110 *============================================================================*/
111
112/*----------------------------------------------------------------------------*/
123/*----------------------------------------------------------------------------*/
124
125inline static cs_real_t
127 const cs_real_t nvf_p_c,
128 const cs_real_t nvf_r_f,
129 const cs_real_t nvf_r_c)
130{
131 cs_real_t nvf_p_f;
132
133 cs_real_t beta_m, rfc, r1f, r1, r2, r3, b1, b2;
134
135 switch (limiter) {
136 case CS_NVD_GAMMA: /* Gamma scheme */
137 beta_m = 0.1; /* in [0.1, 0.5] */
138 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
139
140 if (nvf_p_c < beta_m) {
141 nvf_p_f = nvf_p_c*(1.+rfc*(1.-nvf_p_c)/beta_m);
142 } else {
143 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
144
145 nvf_p_f = r1f*nvf_p_c+rfc;
146 }
147
148 break;
149
150 case CS_NVD_SMART: /* SMART scheme */
151 if (nvf_p_c < (nvf_r_c/3.)) {
152 r1 = nvf_r_f*(1.-3.*nvf_r_c+2.*nvf_r_f);
153 r2 = nvf_r_c*(1.-nvf_r_c);
154
155 nvf_p_f = nvf_p_c*r1/r2;
156 } else if (nvf_p_c <= (nvf_r_c*(1.+nvf_r_f-nvf_r_c)/nvf_r_f)) {
157 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
158 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
159
160 nvf_p_f = nvf_r_f*(r1f*nvf_p_c/nvf_r_c + rfc);
161 } else {
162 nvf_p_f = 1.;
163 }
164
165 break;
166
167 case CS_NVD_CUBISTA: /* CUBISTA scheme */
168 if (nvf_p_c < (3.*nvf_r_c/4.)) {
169 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
170
171 nvf_p_f = nvf_r_f*(1.+rfc/3.)*nvf_p_c/nvf_r_c;
172 } else if (nvf_p_c <= (nvf_r_c*(1.+2.*(nvf_r_f-nvf_r_c))/(2.*nvf_r_f-nvf_r_c))) {
173 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
174 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
175
176 nvf_p_f = nvf_r_f*(r1f*nvf_p_c/nvf_r_c+rfc);
177 } else {
178 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
179
180 nvf_p_f = 1.-.5*r1f*(1.-nvf_p_c);
181 }
182
183 break;
184
185 case CS_NVD_SUPERBEE: /* SuperBee scheme */
186 if (nvf_p_c < (nvf_r_c/(2.-nvf_r_c))) {
187 nvf_p_f = (2.*nvf_r_f-nvf_r_c)*nvf_p_c/nvf_r_c;
188 } else if (nvf_p_c < nvf_r_c) {
189 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
190 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
191
192 nvf_p_f = r1f*nvf_p_c+rfc;
193 } else if (nvf_p_c < (nvf_r_c/nvf_r_f)) {
194 nvf_p_f = nvf_r_f*nvf_p_c/nvf_r_c;
195 } else {
196 nvf_p_f = 1.;
197 }
198
199 break;
200
201 case CS_NVD_MUSCL: /* MUSCL scheme */
202 if (nvf_p_c < (.5*nvf_r_c)) {
203 nvf_p_f = (2.*nvf_r_f-nvf_r_c)*nvf_p_c/nvf_r_c;
204 } else if (nvf_p_c < (1.+nvf_r_c-nvf_r_f)) {
205 nvf_p_f = nvf_p_c+nvf_r_f-nvf_r_c;
206 } else {
207 nvf_p_f = 1.;
208 }
209
210 break;
211
212 case CS_NVD_MINMOD: /* MINMOD scheme */
213 if (nvf_p_c < nvf_r_c) {
214 nvf_p_f = nvf_r_f*nvf_p_c/nvf_r_c;
215 } else {
216 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
217 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
218
219 nvf_p_f = r1f*nvf_p_c+rfc;
220 }
221
222 break;
223
224 case CS_NVD_CLAM: /* CLAM scheme */
225 r1 = nvf_r_c*nvf_r_c-nvf_r_f;
226 r2 = nvf_r_c*(nvf_r_c-1.);
227 r3 = nvf_r_f-nvf_r_c;
228
229 nvf_p_f = nvf_p_c*(r1+r3*nvf_p_c)/r2;
230
231 break;
232
233 case CS_NVD_STOIC: /* STOIC scheme */
234 b1 = (nvf_r_c-nvf_r_f)*nvf_r_c;
235 b2 = nvf_r_c+nvf_r_f+2.*nvf_r_f*nvf_r_f-4.*nvf_r_f*nvf_r_c;
236
237 if (nvf_p_c < (b1/b2)) {
238 r1 = -nvf_r_f*(1.-3.*nvf_r_c+2.*nvf_r_f);
239 r2 = nvf_r_c*(nvf_r_c-1.);
240
241 nvf_p_f = nvf_p_c*r1/r2;
242 } else if (nvf_p_c < nvf_r_c) {
243 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
244 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
245
246 nvf_p_f = r1f*nvf_p_c+rfc;
247 } else if (nvf_p_c < (nvf_r_c*(1.+nvf_r_f-nvf_r_c)/nvf_r_f)) {
248 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
249 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
250
251 nvf_p_f = nvf_r_f*(nvf_p_c*r1f/nvf_r_c+rfc);
252 } else {
253 nvf_p_f = 1.;
254 }
255
256 break;
257
258 case CS_NVD_OSHER: /* OSHER scheme */
259 if (nvf_p_c < (nvf_r_c/nvf_r_f)) {
260 nvf_p_f = nvf_r_f*nvf_p_c/nvf_r_c;
261 } else {
262 nvf_p_f = 1.;
263 }
264
265 break;
266
267 case CS_NVD_WASEB: /* WASEB scheme */
268 r1 = nvf_r_c*nvf_r_f*(nvf_r_f-nvf_r_c);
269 r2 = 2.*nvf_r_c*(1.-nvf_r_c)-nvf_r_f*(1.-nvf_r_f);
270
271 if (nvf_p_c < (r1/r2)) {
272 nvf_p_f = 2.*nvf_p_c;
273 } else if (nvf_p_c <= (nvf_r_c*(1.+nvf_r_f-nvf_r_c)/nvf_r_f)) {
274 rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
275 r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
276
277 nvf_p_f = nvf_r_f*(nvf_p_c*r1f/nvf_r_c+rfc);
278 } else {
279 nvf_p_f = 1.;
280 }
281
282 break;
283
284 default: /* Upwinding */
285 nvf_p_f = nvf_p_c;
286 break;
287 }
288
289 return nvf_p_f;
290}
291
292/*----------------------------------------------------------------------------*/
308/*----------------------------------------------------------------------------*/
309
310inline static cs_real_t
312 const cs_real_3_t i_face_normal,
313 const cs_real_t nvf_p_c,
314 const cs_real_t nvf_r_f,
315 const cs_real_t nvf_r_c,
316 const cs_real_3_t gradv_c,
317 const cs_real_t c_courant)
318{
319 assert(limiter >= CS_NVD_VOF_HRIC);
320
321 cs_real_t nvf_p_f;
322 cs_real_t blend, high_order, low_order, ratio;
323
324 /* Compute gradient angle indicator */
325 cs_real_t dotp = CS_ABS(cs_math_3_dot_product(gradv_c, i_face_normal));
326 cs_real_t sgrad = cs_math_3_norm(gradv_c);
327 cs_real_t snorm = cs_math_3_norm(i_face_normal);
328 cs_real_t denom = snorm*sgrad;
329
330 if (limiter == CS_NVD_VOF_HRIC) { /* M-HRIC scheme */
331 /* High order scheme : Bounded Downwind */
332 if (nvf_p_c <= .5) {
333 high_order = 2.*nvf_p_c;
334 } else {
335 high_order = 1.;
336 }
337
338 /* Low order scheme : MUSCL */
340 nvf_p_c,
341 nvf_r_f,
342 nvf_r_c);
343
344 /* Compute the blending factor */
345 if (denom <= (cs_math_epzero*dotp)) {
346 blend = 1.;
347 } else {
348 ratio = dotp/denom;
349 blend = CS_MIN(1., pow(ratio, .5));
350 }
351
352 /* Blending */
353 nvf_p_f = blend*high_order + (1.-blend)*low_order;
354
355 /* Extra blending due to the cell Courant number */
356 if (c_courant < .7 && c_courant > .3) {
357 nvf_p_f = nvf_p_f + (nvf_p_f - low_order)*(.7 - c_courant )/.4;
358 } else if (c_courant >= .7) {
359 nvf_p_f = low_order;
360 }
361 } else if (limiter == CS_NVD_VOF_CICSAM) { /* M-CICSAM scheme */
362 /* High order scheme : HYPER-C + SUPERBEE */
363 if (c_courant <= .3) {
364 high_order = CS_MIN(1., nvf_p_c/(c_courant+cs_math_epzero));
365 } else if (c_courant <= .6) {
366 high_order = CS_MIN(1., nvf_p_c/.3);
367 } else if (c_courant <= .7) {
369 nvf_p_c,
370 nvf_r_f,
371 nvf_r_c);
372 high_order = 10.*( (.7-c_courant)*CS_MIN(1., nvf_p_c/.3)
373 + (c_courant-.6)*superbee);
374 }
375 else {
377 nvf_p_c,
378 nvf_r_f,
379 nvf_r_c);
380 }
381
382 /* Low order scheme : MUSCL */
384 nvf_p_c,
385 nvf_r_f,
386 nvf_r_c);
387
388 /* Compute the blending factor */
389 if (denom <= (cs_math_epzero*dotp)) {
390 blend = 1.;
391 } else {
392 ratio = dotp/denom;
393 blend = CS_MIN(1., pow(ratio, 2.));
394 }
395
396 /* Blending */
397 nvf_p_f = blend*high_order + (1.-blend)*low_order;
398 } else { /* STACS scheme */
399 /* High order scheme : SUPERBEE */
401 nvf_p_c,
402 nvf_r_f,
403 nvf_r_c);
404
405 /* Low order scheme : STOIC */
407 nvf_p_c,
408 nvf_r_f,
409 nvf_r_c);
410
411 /* Compute the blending factor */
412 if (denom <= (cs_math_epzero*dotp)) {
413 blend = 1.;
414 } else {
415 ratio = dotp/denom;
416 blend = CS_MIN(1., pow(ratio, 4.));
417 }
418
419 /* Blending */
420 nvf_p_f = blend*high_order + (1.-blend)*low_order;
421 }
422
423 return nvf_p_f;
424}
425
426/*----------------------------------------------------------------------------*/
443/*----------------------------------------------------------------------------*/
444
445inline static void
447 const cs_real_t pj,
448 const cs_real_t distf,
449 const cs_real_t srfan,
450 const cs_real_t i_face_normal[3],
451 const cs_real_t gradi[3],
452 const cs_real_t gradj[3],
453 const cs_real_t grdpai[3],
454 const cs_real_t grdpaj[3],
455 const cs_real_t i_massflux,
456 cs_real_t *testij,
457 cs_real_t *tesqck)
458{
459 cs_real_t testi, testj;
460 cs_real_t dcc, ddi, ddj;
461
462 /* Slope test */
463
464 testi = grdpai[0]*i_face_normal[0]
465 + grdpai[1]*i_face_normal[1]
466 + grdpai[2]*i_face_normal[2];
467 testj = grdpaj[0]*i_face_normal[0]
468 + grdpaj[1]*i_face_normal[1]
469 + grdpaj[2]*i_face_normal[2];
470
471 *testij = grdpai[0]*grdpaj[0]
472 + grdpai[1]*grdpaj[1]
473 + grdpai[2]*grdpaj[2];
474
475 if (i_massflux>0.) {
476 dcc = gradi[0]*i_face_normal[0]
477 + gradi[1]*i_face_normal[1]
478 + gradi[2]*i_face_normal[2];
479 ddi = testi;
480 ddj = (pj-pi)/distf *srfan;
481 } else {
482 dcc = gradj[0]*i_face_normal[0]
483 + gradj[1]*i_face_normal[1]
484 + gradj[2]*i_face_normal[2];
485 ddi = (pj-pi)/distf *srfan;
486 ddj = testj;
487 }
488
489 *tesqck = cs_math_sq(dcc) - cs_math_sq(ddi-ddj);
490}
491
492/*----------------------------------------------------------------------------*/
509/*----------------------------------------------------------------------------*/
510
511inline static void
513 const cs_real_t pj[3],
514 const cs_real_t distf,
515 const cs_real_t srfan,
516 const cs_real_t i_face_normal[3],
517 const cs_real_t gradi[3][3],
518 const cs_real_t gradj[3][3],
519 const cs_real_t gradsti[3][3],
520 const cs_real_t gradstj[3][3],
521 const cs_real_t i_massflux,
522 cs_real_t *testij,
523 cs_real_t *tesqck)
524{
525 cs_real_t testi[3], testj[3];
526 cs_real_t dcc[3], ddi[3], ddj[3];
527 *testij = 0.;
528 *tesqck = 0.;
529
530 /* Slope test */
531
532 for (int i = 0; i < 3; i++) {
533 *testij += gradsti[i][0]*gradstj[i][0]
534 + gradsti[i][1]*gradstj[i][1]
535 + gradsti[i][2]*gradstj[i][2];
536
537 testi[i] = gradsti[i][0]*i_face_normal[0]
538 + gradsti[i][1]*i_face_normal[1]
539 + gradsti[i][2]*i_face_normal[2];
540 testj[i] = gradstj[i][0]*i_face_normal[0]
541 + gradstj[i][1]*i_face_normal[1]
542 + gradstj[i][2]*i_face_normal[2];
543
544 if (i_massflux > 0.) {
545 dcc[i] = gradi[i][0]*i_face_normal[0]
546 + gradi[i][1]*i_face_normal[1]
547 + gradi[i][2]*i_face_normal[2];
548 ddi[i] = testi[i];
549 ddj[i] = (pj[i]-pi[i])/distf *srfan;
550 } else {
551 dcc[i] = gradj[i][0]*i_face_normal[0]
552 + gradj[i][1]*i_face_normal[1]
553 + gradj[i][2]*i_face_normal[2];
554 ddi[i] = (pj[i]-pi[i])/distf *srfan;
555 ddj[i] = testj[i];
556 }
557 }
558
559 *tesqck = cs_math_3_square_norm(dcc) - cs_math_3_square_distance(ddi, ddj);
560}
561
562/*----------------------------------------------------------------------------*/
580/*----------------------------------------------------------------------------*/
581
582inline static void
584 const cs_real_3_t pj,
585 const cs_real_t distf,
586 const cs_real_t srfan,
587 const cs_real_3_t i_face_normal,
588 const cs_real_33_t gradi,
589 const cs_real_33_t gradj,
590 const cs_real_33_t grdpai,
591 const cs_real_33_t grdpaj,
592 const cs_real_t i_massflux,
593 cs_real_t testij[3],
594 cs_real_t tesqck[3])
595{
596 cs_real_t testi[3], testj[3];
597 cs_real_t dcc[3], ddi[3], ddj[3];
598
599 /* Slope test
600 ----------*/
601 for (int isou = 0; isou < 3; isou++) {
602 testi[isou] = grdpai[isou][0]*i_face_normal[0]
603 + grdpai[isou][1]*i_face_normal[1]
604 + grdpai[isou][2]*i_face_normal[2];
605 testj[isou] = grdpaj[isou][0]*i_face_normal[0]
606 + grdpaj[isou][1]*i_face_normal[1]
607 + grdpaj[isou][2]*i_face_normal[2];
608 testij[isou] = grdpai[isou][0]*grdpaj[isou][0]
609 + grdpai[isou][1]*grdpaj[isou][1]
610 + grdpai[isou][2]*grdpaj[isou][2];
611
612 if (i_massflux>0.) {
613 dcc[isou] = gradi[isou][0]*i_face_normal[0]
614 + gradi[isou][1]*i_face_normal[1]
615 + gradi[isou][2]*i_face_normal[2];
616 ddi[isou] = testi[isou];
617 ddj[isou] = (pj[isou]-pi[isou])/distf *srfan;
618 } else {
619 dcc[isou] = gradj[isou][0]*i_face_normal[0]
620 + gradj[isou][1]*i_face_normal[1]
621 + gradj[isou][2]*i_face_normal[2];
622 ddi[isou] = (pj[isou]-pi[isou])/distf *srfan;
623 ddj[isou] = testj[isou];
624 }
625 tesqck[isou] = cs_math_sq(dcc[isou]) - cs_math_sq(ddi[isou]-ddj[isou]);
626 }
627}
628
629
630/*----------------------------------------------------------------------------*/
647/*----------------------------------------------------------------------------*/
648
649inline static void
651 const cs_real_t pj[6],
652 const cs_real_t distf,
653 const cs_real_t srfan,
654 const cs_real_t i_face_normal[3],
655 const cs_real_t gradi[6][3],
656 const cs_real_t gradj[6][3],
657 const cs_real_t gradsti[6][3],
658 const cs_real_t gradstj[6][3],
659 const cs_real_t i_massflux,
660 cs_real_t *testij,
661 cs_real_t *tesqck)
662{
663 cs_real_t testi[6], testj[6];
664 cs_real_t dcc[6], ddi[6], ddj[6];
665
666 *testij = 0.;
667 *tesqck = 0.;
668
669 /* Slope test */
670
671 for (int ij = 0; ij < 6; ij++) {
672 *testij += gradsti[ij][0]*gradstj[ij][0]
673 + gradsti[ij][1]*gradstj[ij][1]
674 + gradsti[ij][2]*gradstj[ij][2];
675 testi[ij] = gradsti[ij][0]*i_face_normal[0]
676 + gradsti[ij][1]*i_face_normal[1]
677 + gradsti[ij][2]*i_face_normal[2];
678 testj[ij] = gradstj[ij][0]*i_face_normal[0]
679 + gradstj[ij][1]*i_face_normal[1]
680 + gradstj[ij][2]*i_face_normal[2];
681
682 if (i_massflux > 0.) {
683 dcc[ij] = gradi[ij][0]*i_face_normal[0]
684 + gradi[ij][1]*i_face_normal[1]
685 + gradi[ij][2]*i_face_normal[2];
686 ddi[ij] = testi[ij];
687 ddj[ij] = (pj[ij]-pi[ij])/distf *srfan;
688 } else {
689 dcc[ij] = gradj[ij][0]*i_face_normal[0]
690 + gradj[ij][1]*i_face_normal[1]
691 + gradj[ij][2]*i_face_normal[2];
692 ddi[ij] = (pj[ij]-pi[ij])/distf *srfan;
693 ddj[ij] = testj[ij];
694 }
695
696 *tesqck += cs_math_sq(dcc[ij]) - cs_math_sq(ddi[ij]-ddj[ij]);
697 }
698}
699
700/*----------------------------------------------------------------------------*/
716/*----------------------------------------------------------------------------*/
717
718inline static void
719cs_i_compute_quantities(const int ircflp,
720 const cs_real_3_t diipf,
721 const cs_real_3_t djjpf,
722 const cs_real_3_t gradi,
723 const cs_real_3_t gradj,
724 const cs_real_t pi,
725 const cs_real_t pj,
726 cs_real_t *recoi,
727 cs_real_t *recoj,
728 cs_real_t *pip,
729 cs_real_t *pjp)
730{
731 cs_real_t gradpf[3] = {
732 0.5*(gradi[0] + gradj[0]),
733 0.5*(gradi[1] + gradj[1]),
734 0.5*(gradi[2] + gradj[2])};
735
736 /* reconstruction only if IRCFLP = 1 */
737 *recoi = ircflp*(cs_math_3_dot_product(gradpf, diipf));
738 *recoj = ircflp*(cs_math_3_dot_product(gradpf, djjpf));
739 *pip = pi + *recoi;
740 *pjp = pj + *recoj;
741}
742
743/*----------------------------------------------------------------------------*/
759/*----------------------------------------------------------------------------*/
760
761inline static void
763 const cs_real_3_t diipf,
764 const cs_real_3_t djjpf,
765 const cs_real_33_t gradi,
766 const cs_real_33_t gradj,
767 const cs_real_3_t pi,
768 const cs_real_3_t pj,
769 cs_real_t recoi[3],
770 cs_real_t recoj[3],
771 cs_real_t pip[3],
772 cs_real_t pjp[3])
773{
774 cs_real_3_t dpvf;
775
776 /* x-y-z components, p = u, v, w */
777
778 for (int isou = 0; isou < 3; isou++) {
779
780 for (int jsou = 0; jsou < 3; jsou++)
781 dpvf[jsou] = 0.5*( gradi[isou][jsou]
782 + gradj[isou][jsou]);
783
784 /* reconstruction only if IRCFLP = 1 */
785
786 recoi[isou] = ircflp*(cs_math_3_dot_product(dpvf, diipf));
787
788
789 recoj[isou] = ircflp*(cs_math_3_dot_product(dpvf, djjpf));
790
791 pip[isou] = pi[isou] + recoi[isou];
792
793 pjp[isou] = pj[isou] + recoj[isou];
794
795 }
796}
797
798/*----------------------------------------------------------------------------*/
814/*----------------------------------------------------------------------------*/
815
816inline static void
818 const cs_real_3_t diipf,
819 const cs_real_3_t djjpf,
820 const cs_real_63_t gradi,
821 const cs_real_63_t gradj,
822 const cs_real_6_t pi,
823 const cs_real_6_t pj,
824 cs_real_t recoi[6],
825 cs_real_t recoj[6],
826 cs_real_t pip[6],
827 cs_real_t pjp[6])
828{
829 cs_real_3_t dpvf;
830
831 /* x-y-z components, p = u, v, w */
832
833 for (int isou = 0; isou < 6; isou++) {
834
835 for (int jsou = 0; jsou < 3; jsou++)
836 dpvf[jsou] = 0.5*( gradi[isou][jsou]
837 + gradj[isou][jsou]);
838
839 /* reconstruction only if IRCFLP = 1 */
840
841 recoi[isou] = ircflp*(cs_math_3_dot_product(dpvf, diipf));
842
843 recoj[isou] = ircflp*(cs_math_3_dot_product(dpvf, djjpf));
844
845 pip[isou] = pi[isou] + recoi[isou];
846
847 pjp[isou] = pj[isou] + recoj[isou];
848
849 }
850}
851
852/*----------------------------------------------------------------------------*/
868/*----------------------------------------------------------------------------*/
869
870inline static void
871cs_i_relax_c_val(const double relaxp,
872 const cs_real_t pia,
873 const cs_real_t pja,
874 const cs_real_t recoi,
875 const cs_real_t recoj,
876 const cs_real_t pi,
877 const cs_real_t pj,
878 cs_real_t *pir,
879 cs_real_t *pjr,
880 cs_real_t *pipr,
881 cs_real_t *pjpr)
882{
883 *pir = pi/relaxp - (1.-relaxp)/relaxp * pia;
884 *pjr = pj/relaxp - (1.-relaxp)/relaxp * pja;
885
886 *pipr = *pir + recoi;
887 *pjpr = *pjr + recoj;
888}
889
890/*----------------------------------------------------------------------------*/
906/*----------------------------------------------------------------------------*/
907
908inline static void
909cs_i_relax_c_val_vector(const double relaxp,
910 const cs_real_3_t pia,
911 const cs_real_3_t pja,
912 const cs_real_3_t recoi,
913 const cs_real_3_t recoj,
914 const cs_real_3_t pi,
915 const cs_real_3_t pj,
916 cs_real_t pir[3],
917 cs_real_t pjr[3],
918 cs_real_t pipr[3],
919 cs_real_t pjpr[3])
920{
921 for (int isou = 0; isou < 3; isou++) {
922 pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
923 pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
924
925 pipr[isou] = pir[isou] + recoi[isou];
926 pjpr[isou] = pjr[isou] + recoj[isou];
927 }
928}
929
930/*----------------------------------------------------------------------------*/
946/*----------------------------------------------------------------------------*/
947
948inline static void
950 const cs_real_t pia[6],
951 const cs_real_t pja[6],
952 const cs_real_t recoi[6],
953 const cs_real_t recoj[6],
954 const cs_real_t pi[6],
955 const cs_real_t pj[6],
956 cs_real_t pir[6],
957 cs_real_t pjr[6],
958 cs_real_t pipr[6],
959 cs_real_t pjpr[6])
960{
961 for (int isou = 0; isou < 6; isou++) {
962 pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
963 pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
964
965 pipr[isou] = pir[isou] + recoi[isou];
966 pjpr[isou] = pjr[isou] + recoj[isou];
967 }
968}
969
970/*----------------------------------------------------------------------------*/
977/*----------------------------------------------------------------------------*/
978
979inline static void
981 cs_real_t *pf)
982{
983 *pf = p;
984}
985
986/*----------------------------------------------------------------------------*/
993/*----------------------------------------------------------------------------*/
994
995inline static void
997 cs_real_t pf[3])
998{
999 for (int isou = 0; isou < 3; isou++)
1000 pf[isou] = p[isou];
1001}
1002
1003/*----------------------------------------------------------------------------*/
1010/*----------------------------------------------------------------------------*/
1011
1012inline static void
1014 cs_real_t pf[6])
1015{
1016 for (int isou = 0; isou < 6; isou++)
1017 pf[isou] = p[isou];
1018}
1019
1020/*----------------------------------------------------------------------------*/
1029/*----------------------------------------------------------------------------*/
1030
1031inline static void
1032cs_centered_f_val(const double pnd,
1033 const cs_real_t pip,
1034 const cs_real_t pjp,
1035 cs_real_t *pf)
1036{
1037 *pf = pnd*pip + (1.-pnd)*pjp;
1038}
1039
1040/*----------------------------------------------------------------------------*/
1049/*----------------------------------------------------------------------------*/
1050
1051inline static void
1053 const cs_real_3_t pip,
1054 const cs_real_3_t pjp,
1055 cs_real_t pf[3])
1056{
1057 for (int isou = 0; isou < 3; isou++)
1058 pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
1059}
1060
1061/*----------------------------------------------------------------------------*/
1070/*----------------------------------------------------------------------------*/
1071
1072inline static void
1074 const cs_real_6_t pip,
1075 const cs_real_6_t pjp,
1076 cs_real_t pf[6])
1077{
1078 for (int isou = 0; isou < 6; isou++)
1079 pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
1080}
1081
1082/*----------------------------------------------------------------------------*/
1092/*----------------------------------------------------------------------------*/
1093
1094inline static void
1096 const cs_real_3_t i_face_cog,
1097 const cs_real_3_t grad,
1098 const cs_real_t p,
1099 cs_real_t *pf)
1100{
1101 cs_real_3_t df;
1102
1103 df[0] = i_face_cog[0] - cell_cen[0];
1104 df[1] = i_face_cog[1] - cell_cen[1];
1105 df[2] = i_face_cog[2] - cell_cen[2];
1106
1107 *pf = p + cs_math_3_dot_product(df, grad);
1108}
1109
1110/*----------------------------------------------------------------------------*/
1120/*----------------------------------------------------------------------------*/
1121
1122inline static void
1124 const cs_real_3_t i_face_cog,
1125 const cs_real_33_t grad,
1126 const cs_real_3_t p,
1127 cs_real_t pf[3])
1128{
1129 cs_real_3_t df;
1130
1131 for (int jsou = 0; jsou < 3; jsou++)
1132 df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
1133
1134 for (int isou = 0; isou < 3; isou++) {
1135 pf[isou] = p[isou] + df[0]*grad[isou][0]
1136 + df[1]*grad[isou][1]
1137 + df[2]*grad[isou][2];
1138
1139 }
1140}
1141
1142/*----------------------------------------------------------------------------*/
1152/*----------------------------------------------------------------------------*/
1153
1154inline static void
1156 const cs_real_3_t i_face_cog,
1157 const cs_real_63_t grad,
1158 const cs_real_6_t p,
1159 cs_real_t pf[6])
1160{
1161 cs_real_3_t df;
1162
1163 for (int jsou = 0; jsou < 3; jsou++)
1164 df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
1165
1166 for (int isou = 0; isou < 6; isou++) {
1167 pf[isou] = p[isou] + df[0]*grad[isou][0]
1168 + df[1]*grad[isou][1]
1169 + df[2]*grad[isou][2];
1170 }
1171}
1172
1173/*----------------------------------------------------------------------------*/
1183/*----------------------------------------------------------------------------*/
1184
1185inline static void
1186cs_blend_f_val(const double blencp,
1187 const cs_real_t p,
1188 cs_real_t *pf)
1189{
1190 *pf = blencp * (*pf) + (1. - blencp) * p;
1191}
1192
1193/*----------------------------------------------------------------------------*/
1203/*----------------------------------------------------------------------------*/
1204
1205inline static void
1206cs_blend_f_val_vector(const double blencp,
1207 const cs_real_3_t p,
1208 cs_real_t pf[3])
1209{
1210 for (int isou = 0; isou < 3; isou++)
1211 pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
1212}
1213
1214/*----------------------------------------------------------------------------*/
1224/*----------------------------------------------------------------------------*/
1225
1226inline static void
1227cs_blend_f_val_tensor(const double blencp,
1228 const cs_real_6_t p,
1229 cs_real_t pf[6])
1230{
1231 for (int isou = 0; isou < 6; isou++)
1232 pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
1233}
1234
1235/*----------------------------------------------------------------------------*/
1256/*----------------------------------------------------------------------------*/
1257
1258inline static void
1259cs_i_conv_flux(const int iconvp,
1260 const cs_real_t thetap,
1261 const int imasac,
1262 const cs_real_t pi,
1263 const cs_real_t pj,
1264 const cs_real_t pifri,
1265 const cs_real_t pifrj,
1266 const cs_real_t pjfri,
1267 const cs_real_t pjfrj,
1268 const cs_real_t i_massflux,
1269 const cs_real_t xcppi,
1270 const cs_real_t xcppj,
1271 cs_real_2_t fluxij)
1272{
1273 cs_real_t flui, fluj;
1274
1275 flui = 0.5*(i_massflux + fabs(i_massflux));
1276 fluj = 0.5*(i_massflux - fabs(i_massflux));
1277
1278 fluxij[0] += iconvp*xcppi*(thetap*(flui*pifri + fluj*pjfri) - imasac*i_massflux*pi);
1279 fluxij[1] += iconvp*xcppj*(thetap*(flui*pifrj + fluj*pjfrj) - imasac*i_massflux*pj);
1280}
1281
1282/*----------------------------------------------------------------------------*/
1300/*----------------------------------------------------------------------------*/
1301
1302inline static void
1303cs_i_conv_flux_vector(const int iconvp,
1304 const cs_real_t thetap,
1305 const int imasac,
1306 const cs_real_t pi[3],
1307 const cs_real_t pj[3],
1308 const cs_real_t pifri[3],
1309 const cs_real_t pifrj[3],
1310 const cs_real_t pjfri[3],
1311 const cs_real_t pjfrj[3],
1312 const cs_real_t i_massflux,
1313 cs_real_t fluxi[3],
1314 cs_real_t fluxj[3])
1315{
1316 cs_real_t flui, fluj;
1317
1318 flui = 0.5*(i_massflux + fabs(i_massflux));
1319 fluj = 0.5*(i_massflux - fabs(i_massflux));
1320
1321 for (int isou = 0; isou < 3; isou++) {
1322
1323 fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1324 - imasac*i_massflux*pi[isou]);
1325 fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1326 - imasac*i_massflux*pj[isou]);
1327 }
1328}
1329
1330/*----------------------------------------------------------------------------*/
1348/*----------------------------------------------------------------------------*/
1349
1350inline static void
1351cs_i_conv_flux_tensor(const int iconvp,
1352 const cs_real_t thetap,
1353 const int imasac,
1354 const cs_real_t pi[6],
1355 const cs_real_t pj[6],
1356 const cs_real_t pifri[6],
1357 const cs_real_t pifrj[6],
1358 const cs_real_t pjfri[6],
1359 const cs_real_t pjfrj[6],
1360 const cs_real_t i_massflux,
1361 cs_real_t fluxi[6],
1362 cs_real_t fluxj[6])
1363{
1364 cs_real_t flui, fluj;
1365
1366 flui = 0.5*(i_massflux + fabs(i_massflux));
1367 fluj = 0.5*(i_massflux - fabs(i_massflux));
1368
1369 for (int isou = 0; isou < 6; isou++) {
1370 fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1371 - imasac*i_massflux*pi[isou]);
1372 fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1373 - imasac*i_massflux*pj[isou]);
1374 }
1375}
1376
1377/*----------------------------------------------------------------------------*/
1390/*----------------------------------------------------------------------------*/
1391
1392inline static void
1393cs_i_diff_flux(const int idiffp,
1394 const cs_real_t thetap,
1395 const cs_real_t pip,
1396 const cs_real_t pjp,
1397 const cs_real_t pipr,
1398 const cs_real_t pjpr,
1399 const cs_real_t i_visc,
1400 cs_real_2_t fluxij)
1401{
1402 fluxij[0] += idiffp*thetap*i_visc*(pipr -pjp);
1403 fluxij[1] += idiffp*thetap*i_visc*(pip -pjpr);
1404}
1405
1406/*----------------------------------------------------------------------------*/
1420/*----------------------------------------------------------------------------*/
1421
1422inline static void
1423cs_i_diff_flux_vector(const int idiffp,
1424 const cs_real_t thetap,
1425 const cs_real_t pip[3],
1426 const cs_real_t pjp[3],
1427 const cs_real_t pipr[3],
1428 const cs_real_t pjpr[3],
1429 const cs_real_t i_visc,
1430 cs_real_t fluxi[3],
1431 cs_real_t fluxj[3])
1432{
1433 for (int isou = 0; isou < 3; isou++) {
1434 fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1435 fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1436 }
1437}
1438
1439/*----------------------------------------------------------------------------*/
1453/*----------------------------------------------------------------------------*/
1454
1455inline static void
1456cs_i_diff_flux_tensor(const int idiffp,
1457 const cs_real_t thetap,
1458 const cs_real_t pip[6],
1459 const cs_real_t pjp[6],
1460 const cs_real_t pipr[6],
1461 const cs_real_t pjpr[6],
1462 const cs_real_t i_visc,
1463 cs_real_t fluxi[6],
1464 cs_real_t fluxj[6])
1465{
1466 for (int isou = 0; isou < 6; isou++) {
1467 fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1468 fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1469 }
1470}
1471
1472/*----------------------------------------------------------------------------*/
1496/*----------------------------------------------------------------------------*/
1497
1498inline static void
1499cs_i_cd_steady_upwind(const int ircflp,
1500 const cs_real_t relaxp,
1501 const cs_real_t diipf[3],
1502 const cs_real_t djjpf[3],
1503 const cs_real_t gradi[3],
1504 const cs_real_t gradj[3],
1505 const cs_real_t pi,
1506 const cs_real_t pj,
1507 const cs_real_t pia,
1508 const cs_real_t pja,
1509 cs_real_t *pifri,
1510 cs_real_t *pifrj,
1511 cs_real_t *pjfri,
1512 cs_real_t *pjfrj,
1513 cs_real_t *pip,
1514 cs_real_t *pjp,
1515 cs_real_t *pipr,
1516 cs_real_t *pjpr)
1517{
1518 cs_real_t pir, pjr;
1519 cs_real_t recoi, recoj;
1520
1522 diipf,
1523 djjpf,
1524 gradi,
1525 gradj,
1526 pi,
1527 pj,
1528 &recoi,
1529 &recoj,
1530 pip,
1531 pjp);
1532
1533 cs_i_relax_c_val(relaxp,
1534 pia,
1535 pja,
1536 recoi,
1537 recoj,
1538 pi,
1539 pj,
1540 &pir,
1541 &pjr,
1542 pipr,
1543 pjpr);
1544
1545 cs_upwind_f_val(pi,
1546 pifrj);
1547 cs_upwind_f_val(pir,
1548 pifri);
1549 cs_upwind_f_val(pj,
1550 pjfri);
1551 cs_upwind_f_val(pjr,
1552 pjfrj);
1553}
1554
1555/*----------------------------------------------------------------------------*/
1579/*----------------------------------------------------------------------------*/
1580
1581inline static void
1583 const cs_real_t relaxp,
1584 const cs_real_t diipf[3],
1585 const cs_real_t djjpf[3],
1586 const cs_real_t gradi[3][3],
1587 const cs_real_t gradj[3][3],
1588 const cs_real_t pi[3],
1589 const cs_real_t pj[3],
1590 const cs_real_t pia[3],
1591 const cs_real_t pja[3],
1592 cs_real_t pifri[3],
1593 cs_real_t pifrj[3],
1594 cs_real_t pjfri[3],
1595 cs_real_t pjfrj[3],
1596 cs_real_t pip[3],
1597 cs_real_t pjp[3],
1598 cs_real_t pipr[3],
1599 cs_real_t pjpr[3])
1600{
1601 cs_real_t pir[3], pjr[3];
1602 cs_real_t recoi[3], recoj[3];
1603
1605 diipf,
1606 djjpf,
1607 gradi,
1608 gradj,
1609 pi,
1610 pj,
1611 recoi,
1612 recoj,
1613 pip,
1614 pjp);
1615
1617 pia,
1618 pja,
1619 recoi,
1620 recoj,
1621 pi,
1622 pj,
1623 pir,
1624 pjr,
1625 pipr,
1626 pjpr);
1627
1629 pifrj);
1631 pifri);
1633 pjfri);
1635 pjfrj);
1636}
1637
1638/*----------------------------------------------------------------------------*/
1662/*----------------------------------------------------------------------------*/
1663
1664inline static void
1666 const cs_real_t relaxp,
1667 const cs_real_t diipf[3],
1668 const cs_real_t djjpf[3],
1669 const cs_real_t gradi[6][3],
1670 const cs_real_t gradj[6][3],
1671 const cs_real_t pi[6],
1672 const cs_real_t pj[6],
1673 const cs_real_t pia[6],
1674 const cs_real_t pja[6],
1675 cs_real_t pifri[6],
1676 cs_real_t pifrj[6],
1677 cs_real_t pjfri[6],
1678 cs_real_t pjfrj[6],
1679 cs_real_t pip[6],
1680 cs_real_t pjp[6],
1681 cs_real_t pipr[6],
1682 cs_real_t pjpr[6])
1683{
1684 cs_real_6_t pir, pjr;
1685 cs_real_6_t recoi, recoj;
1686
1688 diipf,
1689 djjpf,
1690 gradi,
1691 gradj,
1692 pi,
1693 pj,
1694 recoi,
1695 recoj,
1696 pip,
1697 pjp);
1698
1700 pia,
1701 pja,
1702 recoi,
1703 recoj,
1704 pi,
1705 pj,
1706 pir,
1707 pjr,
1708 pipr,
1709 pjpr);
1710
1712 pifrj);
1714 pifri);
1716 pjfri);
1718 pjfrj);
1719}
1720
1721/*----------------------------------------------------------------------------*/
1738/*----------------------------------------------------------------------------*/
1739
1740inline static void
1742 const cs_real_t diipf[3],
1743 const cs_real_t djjpf[3],
1744 const cs_real_t gradi[3],
1745 const cs_real_t gradj[3],
1746 const cs_real_t pi,
1747 const cs_real_t pj,
1748 cs_real_t *pif,
1749 cs_real_t *pjf,
1750 cs_real_t *pip,
1751 cs_real_t *pjp)
1752{
1753 cs_real_t recoi, recoj;
1754
1756 diipf,
1757 djjpf,
1758 gradi,
1759 gradj,
1760 pi,
1761 pj,
1762 &recoi,
1763 &recoj,
1764 pip,
1765 pjp);
1766
1767 cs_upwind_f_val(pi, pif);
1768 cs_upwind_f_val(pj, pjf);
1769}
1770
1771/*----------------------------------------------------------------------------*/
1788/*----------------------------------------------------------------------------*/
1789
1790inline static void
1792 const cs_real_t diipf[3],
1793 const cs_real_t djjpf[3],
1794 const cs_real_t gradi[3][3],
1795 const cs_real_t gradj[3][3],
1796 const cs_real_t pi[3],
1797 const cs_real_t pj[3],
1798 cs_real_t pif[3],
1799 cs_real_t pjf[3],
1800 cs_real_t pip[3],
1801 cs_real_t pjp[3])
1802{
1803 cs_real_3_t recoi, recoj;
1804
1806 diipf,
1807 djjpf,
1808 gradi,
1809 gradj,
1810 pi,
1811 pj,
1812 recoi,
1813 recoj,
1814 pip,
1815 pjp);
1816
1817 cs_upwind_f_val_vector(pi, pif);
1818 cs_upwind_f_val_vector(pj, pjf);
1819}
1820
1821/*----------------------------------------------------------------------------*/
1838/*----------------------------------------------------------------------------*/
1839
1840inline static void
1842 const cs_real_t diipf[3],
1843 const cs_real_t djjpf[3],
1844 const cs_real_t gradi[6][3],
1845 const cs_real_t gradj[6][3],
1846 const cs_real_t pi[6],
1847 const cs_real_t pj[6],
1848 cs_real_t pif[6],
1849 cs_real_t pjf[6],
1850 cs_real_t pip[6],
1851 cs_real_t pjp[6])
1852{
1853 cs_real_6_t recoi, recoj;
1854
1856 diipf,
1857 djjpf,
1858 gradi,
1859 gradj,
1860 pi,
1861 pj,
1862 recoi,
1863 recoj,
1864 pip,
1865 pjp);
1866
1867 cs_upwind_f_val_tensor(pi, pif);
1868 cs_upwind_f_val_tensor(pj, pjf);
1869
1870}
1871
1872/*----------------------------------------------------------------------------*/
1905/*----------------------------------------------------------------------------*/
1906
1907inline static void
1908cs_i_cd_steady(const int ircflp,
1909 const int ischcp,
1910 const double relaxp,
1911 const double blencp,
1912 const cs_real_t weight,
1913 const cs_real_t cell_ceni[3],
1914 const cs_real_t cell_cenj[3],
1915 const cs_real_t i_face_cog[3],
1916 const cs_real_t diipf[3],
1917 const cs_real_t djjpf[3],
1918 const cs_real_t gradi[3],
1919 const cs_real_t gradj[3],
1920 const cs_real_t gradupi[3],
1921 const cs_real_t gradupj[3],
1922 const cs_real_t pi,
1923 const cs_real_t pj,
1924 const cs_real_t pia,
1925 const cs_real_t pja,
1926 cs_real_t *pifri,
1927 cs_real_t *pifrj,
1928 cs_real_t *pjfri,
1929 cs_real_t *pjfrj,
1930 cs_real_t *pip,
1931 cs_real_t *pjp,
1932 cs_real_t *pipr,
1933 cs_real_t *pjpr)
1934{
1935 cs_real_t pir, pjr;
1936 cs_real_t recoi, recoj;
1937
1939 diipf,
1940 djjpf,
1941 gradi,
1942 gradj,
1943 pi,
1944 pj,
1945 &recoi,
1946 &recoj,
1947 pip,
1948 pjp);
1949
1950 cs_i_relax_c_val(relaxp,
1951 pia,
1952 pja,
1953 recoi,
1954 recoj,
1955 pi,
1956 pj,
1957 &pir,
1958 &pjr,
1959 pipr,
1960 pjpr);
1961
1962 if (ischcp == 1) {
1963
1964 /* Centered
1965 --------*/
1966
1967 cs_centered_f_val(weight,
1968 *pip,
1969 *pjpr,
1970 pifrj);
1971 cs_centered_f_val(weight,
1972 *pipr,
1973 *pjp,
1974 pifri);
1975 cs_centered_f_val(weight,
1976 *pipr,
1977 *pjp,
1978 pjfri);
1979 cs_centered_f_val(weight,
1980 *pip,
1981 *pjpr,
1982 pjfrj);
1983
1984 } else if (ischcp == 0) {
1985
1986 /* Original SOLU
1987 --------------*/
1988
1989 cs_solu_f_val(cell_ceni,
1990 i_face_cog,
1991 gradi,
1992 pi,
1993 pifrj);
1994 cs_solu_f_val(cell_ceni,
1995 i_face_cog,
1996 gradi,
1997 pir,
1998 pifri);
1999 cs_solu_f_val(cell_cenj,
2000 i_face_cog,
2001 gradj,
2002 pj,
2003 pjfri);
2004 cs_solu_f_val(cell_cenj,
2005 i_face_cog,
2006 gradj,
2007 pjr,
2008 pjfrj);
2009
2010 } else {
2011
2012 /* SOLU
2013 ----*/
2014
2015 cs_solu_f_val(cell_ceni,
2016 i_face_cog,
2017 gradupi,
2018 pi,
2019 pifrj);
2020 cs_solu_f_val(cell_ceni,
2021 i_face_cog,
2022 gradupi,
2023 pir,
2024 pifri);
2025 cs_solu_f_val(cell_cenj,
2026 i_face_cog,
2027 gradupj,
2028 pj,
2029 pjfri);
2030 cs_solu_f_val(cell_cenj,
2031 i_face_cog,
2032 gradupj,
2033 pjr,
2034 pjfrj);
2035
2036 }
2037
2038 /* Blending
2039 --------*/
2040
2041 cs_blend_f_val(blencp,
2042 pi,
2043 pifrj);
2044 cs_blend_f_val(blencp,
2045 pir,
2046 pifri);
2047 cs_blend_f_val(blencp,
2048 pj,
2049 pjfri);
2050 cs_blend_f_val(blencp,
2051 pjr,
2052 pjfrj);
2053}
2054
2055/*----------------------------------------------------------------------------*/
2086/*----------------------------------------------------------------------------*/
2087
2088inline static void
2089cs_i_cd_steady_vector(const int ircflp,
2090 const int ischcp,
2091 const double relaxp,
2092 const double blencp,
2093 const cs_real_t weight,
2094 const cs_real_3_t cell_ceni,
2095 const cs_real_3_t cell_cenj,
2096 const cs_real_3_t i_face_cog,
2097 const cs_real_3_t diipf,
2098 const cs_real_3_t djjpf,
2099 const cs_real_33_t gradi,
2100 const cs_real_33_t gradj,
2101 const cs_real_3_t pi,
2102 const cs_real_3_t pj,
2103 const cs_real_3_t pia,
2104 const cs_real_3_t pja,
2105 cs_real_t pifri[3],
2106 cs_real_t pifrj[3],
2107 cs_real_t pjfri[3],
2108 cs_real_t pjfrj[3],
2109 cs_real_t pip[3],
2110 cs_real_t pjp[3],
2111 cs_real_t pipr[3],
2112 cs_real_t pjpr[3])
2113{
2114 cs_real_3_t pir, pjr;
2115 cs_real_3_t recoi, recoj;
2116
2118 diipf,
2119 djjpf,
2120 gradi,
2121 gradj,
2122 pi,
2123 pj,
2124 recoi,
2125 recoj,
2126 pip,
2127 pjp);
2128
2130 pia,
2131 pja,
2132 recoi,
2133 recoj,
2134 pi,
2135 pj,
2136 pir,
2137 pjr,
2138 pipr,
2139 pjpr);
2140
2141 if (ischcp == 1) {
2142
2143 /* Centered
2144 --------*/
2145
2147 pip,
2148 pjpr,
2149 pifrj);
2151 pipr,
2152 pjp,
2153 pifri);
2155 pipr,
2156 pjp,
2157 pjfri);
2159 pip,
2160 pjpr,
2161 pjfrj);
2162
2163 } else {
2164
2165 /* Second order
2166 ------------*/
2167
2168 cs_solu_f_val_vector(cell_ceni,
2169 i_face_cog,
2170 gradi,
2171 pi,
2172 pifrj);
2173 cs_solu_f_val_vector(cell_ceni,
2174 i_face_cog,
2175 gradi,
2176 pir,
2177 pifri);
2178 cs_solu_f_val_vector(cell_cenj,
2179 i_face_cog,
2180 gradj,
2181 pj,
2182 pjfri);
2183 cs_solu_f_val_vector(cell_cenj,
2184 i_face_cog,
2185 gradj,
2186 pjr,
2187 pjfrj);
2188
2189 }
2190
2191 /* Blending
2192 --------*/
2193 cs_blend_f_val_vector(blencp,
2194 pi,
2195 pifrj);
2196 cs_blend_f_val_vector(blencp,
2197 pir,
2198 pifri);
2199 cs_blend_f_val_vector(blencp,
2200 pj,
2201 pjfri);
2202 cs_blend_f_val_vector(blencp,
2203 pjr,
2204 pjfrj);
2205
2206}
2207
2208/*----------------------------------------------------------------------------*/
2239/*----------------------------------------------------------------------------*/
2240
2241inline static void
2242cs_i_cd_steady_tensor(const int ircflp,
2243 const int ischcp,
2244 const double relaxp,
2245 const double blencp,
2246 const cs_real_t weight,
2247 const cs_real_3_t cell_ceni,
2248 const cs_real_3_t cell_cenj,
2249 const cs_real_3_t i_face_cog,
2250 const cs_real_3_t diipf,
2251 const cs_real_3_t djjpf,
2252 const cs_real_63_t gradi,
2253 const cs_real_63_t gradj,
2254 const cs_real_6_t pi,
2255 const cs_real_6_t pj,
2256 const cs_real_6_t pia,
2257 const cs_real_6_t pja,
2258 cs_real_t pifri[6],
2259 cs_real_t pifrj[6],
2260 cs_real_t pjfri[6],
2261 cs_real_t pjfrj[6],
2262 cs_real_t pip[6],
2263 cs_real_t pjp[6],
2264 cs_real_t pipr[6],
2265 cs_real_t pjpr[6])
2266
2267{
2268 cs_real_6_t pir, pjr;
2269 cs_real_6_t recoi, recoj;
2270
2272 diipf,
2273 djjpf,
2274 gradi,
2275 gradj,
2276 pi,
2277 pj,
2278 recoi,
2279 recoj,
2280 pip,
2281 pjp);
2282
2284 pia,
2285 pja,
2286 recoi,
2287 recoj,
2288 pi,
2289 pj,
2290 pir,
2291 pjr,
2292 pipr,
2293 pjpr);
2294
2295 if (ischcp == 1) {
2296
2297 /* Centered
2298 --------*/
2299
2301 pip,
2302 pjpr,
2303 pifrj);
2305 pipr,
2306 pjp,
2307 pifri);
2309 pipr,
2310 pjp,
2311 pjfri);
2313 pip,
2314 pjpr,
2315 pjfrj);
2316
2317 } else {
2318
2319 /* Second order
2320 ------------*/
2321
2322 cs_solu_f_val_tensor(cell_ceni,
2323 i_face_cog,
2324 gradi,
2325 pi,
2326 pifrj);
2327 cs_solu_f_val_tensor(cell_ceni,
2328 i_face_cog,
2329 gradi,
2330 pir,
2331 pifri);
2332 cs_solu_f_val_tensor(cell_cenj,
2333 i_face_cog,
2334 gradj,
2335 pj,
2336 pjfri);
2337 cs_solu_f_val_tensor(cell_cenj,
2338 i_face_cog,
2339 gradj,
2340 pjr,
2341 pjfrj);
2342
2343 }
2344
2345 /* Blending
2346 --------*/
2347
2348 cs_blend_f_val_tensor(blencp,
2349 pi,
2350 pifrj);
2351 cs_blend_f_val_tensor(blencp,
2352 pir,
2353 pifri);
2354 cs_blend_f_val_tensor(blencp,
2355 pj,
2356 pjfri);
2357 cs_blend_f_val_tensor(blencp,
2358 pjr,
2359 pjfrj);
2360
2361}
2362
2363/*----------------------------------------------------------------------------*/
2393/*----------------------------------------------------------------------------*/
2394
2395inline static void
2396cs_i_cd_unsteady(const int ircflp,
2397 const int ischcp,
2398 const double blencp,
2399 const cs_real_t weight,
2400 const cs_real_3_t cell_ceni,
2401 const cs_real_3_t cell_cenj,
2402 const cs_real_3_t i_face_cog,
2403 const cs_real_t hybrid_blend_i,
2404 const cs_real_t hybrid_blend_j,
2405 const cs_real_3_t diipf,
2406 const cs_real_3_t djjpf,
2407 const cs_real_3_t gradi,
2408 const cs_real_3_t gradj,
2409 const cs_real_3_t gradupi,
2410 const cs_real_3_t gradupj,
2411 const cs_real_t pi,
2412 const cs_real_t pj,
2413 cs_real_t *pif,
2414 cs_real_t *pjf,
2415 cs_real_t *pip,
2416 cs_real_t *pjp)
2417{
2418 cs_real_t recoi, recoj;
2419
2421 diipf,
2422 djjpf,
2423 gradi,
2424 gradj,
2425 pi,
2426 pj,
2427 &recoi,
2428 &recoj,
2429 pip,
2430 pjp);
2431
2432
2433 if (ischcp == 1) {
2434
2435 /* Centered
2436 --------*/
2437
2438 cs_centered_f_val(weight,
2439 *pip,
2440 *pjp,
2441 pif);
2442 cs_centered_f_val(weight,
2443 *pip,
2444 *pjp,
2445 pjf);
2446
2447 } else if (ischcp == 0) {
2448
2449 /* Legacy SOLU
2450 -----------*/
2451
2452 cs_solu_f_val(cell_ceni,
2453 i_face_cog,
2454 gradi,
2455 pi,
2456 pif);
2457 cs_solu_f_val(cell_cenj,
2458 i_face_cog,
2459 gradj,
2460 pj,
2461 pjf);
2462
2463 } else if (ischcp == 3) {
2464
2465 /* Centered
2466 --------*/
2467
2468 cs_centered_f_val(weight,
2469 *pip,
2470 *pjp,
2471 pif);
2472 cs_centered_f_val(weight,
2473 *pip,
2474 *pjp,
2475 pjf);
2476
2477 /* Legacy SOLU
2478 -----------*/
2479 cs_real_t pif_up, pjf_up;
2480 cs_real_t hybrid_blend_interp;
2481
2482 cs_solu_f_val(cell_ceni,
2483 i_face_cog,
2484 gradi,
2485 pi,
2486 &pif_up);
2487 cs_solu_f_val(cell_cenj,
2488 i_face_cog,
2489 gradj,
2490 pj,
2491 &pjf_up);
2492
2493 hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2494 *pif = hybrid_blend_interp*(*pif) + (1. - hybrid_blend_interp)*pif_up;
2495 *pjf = hybrid_blend_interp*(*pjf) + (1. - hybrid_blend_interp)*pjf_up;
2496
2497 } else {
2498
2499 /* SOLU
2500 ----*/
2501
2502 cs_solu_f_val(cell_ceni,
2503 i_face_cog,
2504 gradupi,
2505 pi,
2506 pif);
2507 cs_solu_f_val(cell_cenj,
2508 i_face_cog,
2509 gradupj,
2510 pj,
2511 pjf);
2512
2513 }
2514
2515
2516 /* Blending
2517 --------*/
2518
2519 cs_blend_f_val(blencp,
2520 pi,
2521 pif);
2522 cs_blend_f_val(blencp,
2523 pj,
2524 pjf);
2525}
2526
2527/*----------------------------------------------------------------------------*/
2553/*----------------------------------------------------------------------------*/
2554
2555inline static void
2557 const int ischcp,
2558 const double blencp,
2559 const cs_real_t weight,
2560 const cs_real_3_t cell_ceni,
2561 const cs_real_3_t cell_cenj,
2562 const cs_real_3_t i_face_cog,
2563 const cs_real_t hybrid_blend_i,
2564 const cs_real_t hybrid_blend_j,
2565 const cs_real_3_t diipf,
2566 const cs_real_3_t djjpf,
2567 const cs_real_33_t gradi,
2568 const cs_real_33_t gradj,
2569 const cs_real_3_t pi,
2570 const cs_real_3_t pj,
2571 cs_real_t pif[3],
2572 cs_real_t pjf[3],
2573 cs_real_t pip[3],
2574 cs_real_t pjp[3])
2575
2576{
2577 cs_real_3_t recoi, recoj;
2578
2580 diipf,
2581 djjpf,
2582 gradi,
2583 gradj,
2584 pi,
2585 pj,
2586 recoi,
2587 recoj,
2588 pip,
2589 pjp);
2590
2591 if (ischcp == 1) {
2592
2593 /* Centered
2594 --------*/
2595
2597 pip,
2598 pjp,
2599 pif);
2601 pip,
2602 pjp,
2603 pjf);
2604 } else if (ischcp == 3) {
2605
2606 /* Centered
2607 --------*/
2608
2610 pip,
2611 pjp,
2612 pif);
2614 pip,
2615 pjp,
2616 pjf);
2617
2618 /* SOLU
2619 -----*/
2620 cs_real_t pif_up[3], pjf_up[3];
2621 cs_real_t hybrid_blend_interp;
2622
2623 cs_solu_f_val_vector(cell_ceni,
2624 i_face_cog,
2625 gradi,
2626 pi,
2627 pif_up);
2628 cs_solu_f_val_vector(cell_cenj,
2629 i_face_cog,
2630 gradj,
2631 pj,
2632 pjf_up);
2633
2634 hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2635 for (int isou = 0; isou < 3; isou++) {
2636 pif[isou] = hybrid_blend_interp *pif[isou]
2637 + (1. - hybrid_blend_interp)*pif_up[isou];
2638 pjf[isou] = hybrid_blend_interp *pjf[isou]
2639 + (1. - hybrid_blend_interp)*pjf_up[isou];
2640 }
2641 } else {
2642
2643 /* Second order
2644 ------------*/
2645
2646 cs_solu_f_val_vector(cell_ceni,
2647 i_face_cog,
2648 gradi,
2649 pi,
2650 pif);
2651 cs_solu_f_val_vector(cell_cenj,
2652 i_face_cog,
2653 gradj,
2654 pj,
2655 pjf);
2656
2657 }
2658
2659 /* Blending
2660 --------*/
2661
2662 cs_blend_f_val_vector(blencp,
2663 pi,
2664 pif);
2665 cs_blend_f_val_vector(blencp,
2666 pj,
2667 pjf);
2668
2669}
2670
2671/*----------------------------------------------------------------------------*/
2695/*----------------------------------------------------------------------------*/
2696
2697inline static void
2699 const int ischcp,
2700 const double blencp,
2701 const cs_real_t weight,
2702 const cs_real_3_t cell_ceni,
2703 const cs_real_3_t cell_cenj,
2704 const cs_real_3_t i_face_cog,
2705 const cs_real_3_t diipf,
2706 const cs_real_3_t djjpf,
2707 const cs_real_63_t gradi,
2708 const cs_real_63_t gradj,
2709 const cs_real_6_t pi,
2710 const cs_real_6_t pj,
2711 cs_real_t pif[6],
2712 cs_real_t pjf[6],
2713 cs_real_t pip[6],
2714 cs_real_t pjp[6])
2715
2716{
2717 cs_real_6_t recoi, recoj;
2718
2720 diipf,
2721 djjpf,
2722 gradi,
2723 gradj,
2724 pi,
2725 pj,
2726 recoi,
2727 recoj,
2728 pip,
2729 pjp);
2730
2731 if (ischcp == 1) {
2732
2733 /* Centered
2734 --------*/
2735
2737 pip,
2738 pjp,
2739 pif);
2741 pip,
2742 pjp,
2743 pjf);
2744
2745 } else {
2746
2747 /* Second order
2748 ------------*/
2749
2750 cs_solu_f_val_tensor(cell_ceni,
2751 i_face_cog,
2752 gradi,
2753 pi,
2754 pif);
2755 cs_solu_f_val_tensor(cell_cenj,
2756 i_face_cog,
2757 gradj,
2758 pj,
2759 pjf);
2760
2761 }
2762
2763 /* Blending
2764 --------*/
2765
2766 cs_blend_f_val_tensor(blencp,
2767 pi,
2768 pif);
2769 cs_blend_f_val_tensor(blencp,
2770 pj,
2771 pjf);
2772
2773}
2774
2775/*----------------------------------------------------------------------------*/
2819/*----------------------------------------------------------------------------*/
2820
2821inline static void
2822cs_i_cd_steady_slope_test(bool *upwind_switch,
2823 const int iconvp,
2824 const int ircflp,
2825 const int ischcp,
2826 const double relaxp,
2827 const double blencp,
2828 const double blend_st,
2829 const cs_real_t weight,
2830 const cs_real_t i_dist,
2831 const cs_real_t i_face_surf,
2832 const cs_real_3_t cell_ceni,
2833 const cs_real_3_t cell_cenj,
2834 const cs_real_3_t i_face_normal,
2835 const cs_real_3_t i_face_cog,
2836 const cs_real_3_t diipf,
2837 const cs_real_3_t djjpf,
2838 const cs_real_t i_massflux,
2839 const cs_real_3_t gradi,
2840 const cs_real_3_t gradj,
2841 const cs_real_3_t gradupi,
2842 const cs_real_3_t gradupj,
2843 const cs_real_3_t gradsti,
2844 const cs_real_3_t gradstj,
2845 const cs_real_t pi,
2846 const cs_real_t pj,
2847 const cs_real_t pia,
2848 const cs_real_t pja,
2849 cs_real_t *pifri,
2850 cs_real_t *pifrj,
2851 cs_real_t *pjfri,
2852 cs_real_t *pjfrj,
2853 cs_real_t *pip,
2854 cs_real_t *pjp,
2855 cs_real_t *pipr,
2856 cs_real_t *pjpr)
2857{
2858 cs_real_t pir, pjr;
2859 cs_real_t recoi, recoj;
2860 cs_real_t testij, tesqck;
2861
2862 *upwind_switch = false;
2863
2865 diipf,
2866 djjpf,
2867 gradi,
2868 gradj,
2869 pi,
2870 pj,
2871 &recoi,
2872 &recoj,
2873 pip,
2874 pjp);
2875
2876 cs_i_relax_c_val(relaxp,
2877 pia,
2878 pja,
2879 recoi,
2880 recoj,
2881 pi,
2882 pj,
2883 &pir,
2884 &pjr,
2885 pipr,
2886 pjpr);
2887
2888 /* Convection slope test is needed only when iconv >0 */
2889 if (iconvp > 0) {
2890 cs_slope_test(pi,
2891 pj,
2892 i_dist,
2893 i_face_surf,
2894 i_face_normal,
2895 gradi,
2896 gradj,
2897 gradsti,
2898 gradstj,
2899 i_massflux,
2900 &testij,
2901 &tesqck);
2902
2903 if (ischcp==1) {
2904
2905 /* Centered
2906 --------*/
2907
2908 cs_centered_f_val(weight,
2909 *pip,
2910 *pjpr,
2911 pifrj);
2912 cs_centered_f_val(weight,
2913 *pipr,
2914 *pjp,
2915 pifri);
2916 cs_centered_f_val(weight,
2917 *pipr,
2918 *pjp,
2919 pjfri);
2920 cs_centered_f_val(weight,
2921 *pip,
2922 *pjpr,
2923 pjfrj);
2924
2925 } else if (ischcp == 0) {
2926
2927 /* Second order
2928 ------------*/
2929
2930 cs_solu_f_val(cell_ceni,
2931 i_face_cog,
2932 gradi,
2933 pi,
2934 pifrj);
2935 cs_solu_f_val(cell_ceni,
2936 i_face_cog,
2937 gradi,
2938 pir,
2939 pifri);
2940 cs_solu_f_val(cell_cenj,
2941 i_face_cog,
2942 gradj,
2943 pj,
2944 pjfri);
2945 cs_solu_f_val(cell_cenj,
2946 i_face_cog,
2947 gradj,
2948 pjr,
2949 pjfrj);
2950
2951 } else {
2952
2953 /* SOLU
2954 -----*/
2955
2956 cs_solu_f_val(cell_ceni,
2957 i_face_cog,
2958 gradupi,
2959 pi,
2960 pifrj);
2961 cs_solu_f_val(cell_ceni,
2962 i_face_cog,
2963 gradupi,
2964 pir,
2965 pifri);
2966 cs_solu_f_val(cell_cenj,
2967 i_face_cog,
2968 gradupj,
2969 pj,
2970 pjfri);
2971 cs_solu_f_val(cell_cenj,
2972 i_face_cog,
2973 gradupj,
2974 pjr,
2975 pjfrj);
2976 }
2977
2978
2979 /* Slope test: Pourcentage of upwind
2980 ----------------------------------*/
2981
2982 if (tesqck <= 0. || testij <= 0.) {
2983
2984 cs_blend_f_val(blend_st,
2985 pi,
2986 pifrj);
2987 cs_blend_f_val(blend_st,
2988 pir,
2989 pifri);
2990 cs_blend_f_val(blend_st,
2991 pj,
2992 pjfri);
2993 cs_blend_f_val(blend_st,
2994 pjr,
2995 pjfrj);
2996
2997 *upwind_switch = true;
2998
2999 }
3000
3001
3002 /* Blending
3003 --------*/
3004
3005 cs_blend_f_val(blencp,
3006 pi,
3007 pifrj);
3008 cs_blend_f_val(blencp,
3009 pir,
3010 pifri);
3011 cs_blend_f_val(blencp,
3012 pj,
3013 pjfri);
3014 cs_blend_f_val(blencp,
3015 pjr,
3016 pjfrj);
3017
3018 /* If iconv=0 p*fr* are useless */
3019 } else {
3020 cs_upwind_f_val(pi,
3021 pifrj);
3022 cs_upwind_f_val(pir,
3023 pifri);
3024 cs_upwind_f_val(pj,
3025 pjfri);
3026 cs_upwind_f_val(pjr,
3027 pjfrj);
3028 }
3029
3030}
3031
3032/*----------------------------------------------------------------------------*/
3071/*----------------------------------------------------------------------------*/
3072
3073inline static void
3075 const int iconvp,
3076 const int ircflp,
3077 const int ischcp,
3078 const double relaxp,
3079 const double blencp,
3080 const cs_real_t weight,
3081 const cs_real_t i_dist,
3082 const cs_real_t i_face_surf,
3083 const cs_real_3_t cell_ceni,
3084 const cs_real_3_t cell_cenj,
3085 const cs_real_3_t i_face_normal,
3086 const cs_real_3_t i_face_cog,
3087 const cs_real_3_t diipf,
3088 const cs_real_3_t djjpf,
3089 const cs_real_t i_massflux,
3090 const cs_real_33_t gradi,
3091 const cs_real_33_t gradj,
3092 const cs_real_33_t grdpai,
3093 const cs_real_33_t grdpaj,
3094 const cs_real_3_t pi,
3095 const cs_real_3_t pj,
3096 const cs_real_3_t pia,
3097 const cs_real_3_t pja,
3098 cs_real_t pifri[3],
3099 cs_real_t pifrj[3],
3100 cs_real_t pjfri[3],
3101 cs_real_t pjfrj[3],
3102 cs_real_t pip[3],
3103 cs_real_t pjp[3],
3104 cs_real_t pipr[3],
3105 cs_real_t pjpr[3])
3106{
3107 cs_real_3_t pir, pjr;
3108 cs_real_3_t recoi, recoj;
3109 cs_real_t distf, srfan;
3110 cs_real_3_t testij, tesqck;
3111 int isou;
3112
3113 distf = i_dist;
3114 srfan = i_face_surf;
3115
3117 diipf,
3118 djjpf,
3119 gradi,
3120 gradj,
3121 pi,
3122 pj,
3123 recoi,
3124 recoj,
3125 pip,
3126 pjp);
3127
3129 pia,
3130 pja,
3131 recoi,
3132 recoj,
3133 pi,
3134 pj,
3135 pir,
3136 pjr,
3137 pipr,
3138 pjpr);
3139
3140 /* Convection slope test is needed only when iconv >0 */
3141 if (iconvp > 0) {
3143 pj,
3144 distf,
3145 srfan,
3146 i_face_normal,
3147 gradi,
3148 gradj,
3149 grdpai,
3150 grdpaj,
3151 i_massflux,
3152 testij,
3153 tesqck);
3154
3155 for (isou = 0; isou < 3; isou++) {
3156 if (tesqck[isou]<=0. || testij[isou]<=0.) {
3157
3158 /* Upwind
3159 --------*/
3160
3161 cs_upwind_f_val(pi[isou],
3162 &pifrj[isou]);
3163 cs_upwind_f_val(pir[isou],
3164 &pifri[isou]);
3165 cs_upwind_f_val(pj[isou],
3166 &pjfri[isou]);
3167 cs_upwind_f_val(pjr[isou],
3168 &pjfrj[isou]);
3169
3170 *upwind_switch = true;
3171
3172 } else {
3173
3174 if (ischcp==1) {
3175
3176 /* Centered
3177 --------*/
3178
3179 cs_centered_f_val(weight,
3180 pip[isou],
3181 pjpr[isou],
3182 &pifrj[isou]);
3183 cs_centered_f_val(weight,
3184 pipr[isou],
3185 pjp[isou],
3186 &pifri[isou]);
3187 cs_centered_f_val(weight,
3188 pipr[isou],
3189 pjp[isou],
3190 &pjfri[isou]);
3191 cs_centered_f_val(weight,
3192 pip[isou],
3193 pjpr[isou],
3194 &pjfrj[isou]);
3195
3196 } else {
3197
3198 /* Second order
3199 ------------*/
3200
3201 cs_solu_f_val(cell_ceni,
3202 i_face_cog,
3203 gradi[isou],
3204 pi[isou],
3205 &pifrj[isou]);
3206 cs_solu_f_val(cell_ceni,
3207 i_face_cog,
3208 gradi[isou],
3209 pir[isou],
3210 &pifri[isou]);
3211 cs_solu_f_val(cell_cenj,
3212 i_face_cog,
3213 gradj[isou],
3214 pj[isou],
3215 &pjfri[isou]);
3216 cs_solu_f_val(cell_cenj,
3217 i_face_cog,
3218 gradj[isou],
3219 pjr[isou],
3220 &pjfrj[isou]);
3221
3222 }
3223 }
3224 }
3225
3226 /* Blending
3227 --------*/
3228 cs_blend_f_val_vector(blencp,
3229 pi,
3230 pifrj);
3231 cs_blend_f_val_vector(blencp,
3232 pir,
3233 pifri);
3234 cs_blend_f_val_vector(blencp,
3235 pj,
3236 pjfri);
3237 cs_blend_f_val_vector(blencp,
3238 pjr,
3239 pjfrj);
3240
3241 /* If iconv=0 p*fr* are useless */
3242 } else {
3243 for (isou = 0; isou < 3; isou++) {
3244 cs_upwind_f_val(pi[isou],
3245 &pifrj[isou]);
3246 cs_upwind_f_val(pir[isou],
3247 &pifri[isou]);
3248 cs_upwind_f_val(pj[isou],
3249 &pjfri[isou]);
3250 cs_upwind_f_val(pjr[isou],
3251 &pjfrj[isou]);
3252 }
3253 }
3254
3255}
3256
3257/*----------------------------------------------------------------------------*/
3299/*----------------------------------------------------------------------------*/
3300
3301inline static void
3303 const int iconvp,
3304 const int ircflp,
3305 const int ischcp,
3306 const double relaxp,
3307 const double blencp,
3308 const double blend_st,
3309 const cs_real_t weight,
3310 const cs_real_t i_dist,
3311 const cs_real_t i_face_surf,
3312 const cs_real_3_t cell_ceni,
3313 const cs_real_3_t cell_cenj,
3314 const cs_real_3_t i_face_normal,
3315 const cs_real_3_t i_face_cog,
3316 const cs_real_3_t diipf,
3317 const cs_real_3_t djjpf,
3318 const cs_real_t i_massflux,
3319 const cs_real_33_t gradi,
3320 const cs_real_33_t gradj,
3321 const cs_real_33_t grdpai,
3322 const cs_real_33_t grdpaj,
3323 const cs_real_3_t pi,
3324 const cs_real_3_t pj,
3325 const cs_real_3_t pia,
3326 const cs_real_3_t pja,
3327 cs_real_t pifri[3],
3328 cs_real_t pifrj[3],
3329 cs_real_t pjfri[3],
3330 cs_real_t pjfrj[3],
3331 cs_real_t pip[3],
3332 cs_real_t pjp[3],
3333 cs_real_t pipr[3],
3334 cs_real_t pjpr[3])
3335{
3336 cs_real_3_t pir, pjr;
3337 cs_real_3_t recoi, recoj;
3338 cs_real_t testij, tesqck;
3339 int isou;
3340
3342 diipf,
3343 djjpf,
3344 gradi,
3345 gradj,
3346 pi,
3347 pj,
3348 recoi,
3349 recoj,
3350 pip,
3351 pjp);
3352
3354 pia,
3355 pja,
3356 recoi,
3357 recoj,
3358 pi,
3359 pj,
3360 pir,
3361 pjr,
3362 pipr,
3363 pjpr);
3364
3365 /* Convection slope test is needed only when iconv >0 */
3366 if (iconvp > 0) {
3368 pj,
3369 i_dist,
3370 i_face_surf,
3371 i_face_normal,
3372 gradi,
3373 gradj,
3374 grdpai,
3375 grdpaj,
3376 i_massflux,
3377 &testij,
3378 &tesqck);
3379
3380 for (isou = 0; isou < 3; isou++) {
3381 if (ischcp==1) {
3382
3383 /* Centered
3384 --------*/
3385
3386 cs_centered_f_val(weight,
3387 pip[isou],
3388 pjpr[isou],
3389 &pifrj[isou]);
3390 cs_centered_f_val(weight,
3391 pipr[isou],
3392 pjp[isou],
3393 &pifri[isou]);
3394 cs_centered_f_val(weight,
3395 pipr[isou],
3396 pjp[isou],
3397 &pjfri[isou]);
3398 cs_centered_f_val(weight,
3399 pip[isou],
3400 pjpr[isou],
3401 &pjfrj[isou]);
3402
3403 } else {
3404
3405 /* Second order
3406 ------------*/
3407
3408 cs_solu_f_val(cell_ceni,
3409 i_face_cog,
3410 gradi[isou],
3411 pi[isou],
3412 &pifrj[isou]);
3413 cs_solu_f_val(cell_ceni,
3414 i_face_cog,
3415 gradi[isou],
3416 pir[isou],
3417 &pifri[isou]);
3418 cs_solu_f_val(cell_cenj,
3419 i_face_cog,
3420 gradj[isou],
3421 pj[isou],
3422 &pjfri[isou]);
3423 cs_solu_f_val(cell_cenj,
3424 i_face_cog,
3425 gradj[isou],
3426 pjr[isou],
3427 &pjfrj[isou]);
3428
3429 }
3430
3431 }
3432
3433 /* Slope test: Pourcentage of upwind
3434 ----------------------------------*/
3435
3436 if (tesqck <= 0. || testij <= 0.) {
3437 cs_blend_f_val_vector(blend_st,
3438 pi,
3439 pifrj);
3440 cs_blend_f_val_vector(blend_st,
3441 pir,
3442 pifri);
3443 cs_blend_f_val_vector(blend_st,
3444 pj,
3445 pjfri);
3446 cs_blend_f_val_vector(blend_st,
3447 pjr,
3448 pjfrj);
3449
3450 *upwind_switch = true;
3451 }
3452
3453
3454 /* Blending
3455 --------*/
3456 cs_blend_f_val_vector(blencp,
3457 pi,
3458 pifrj);
3459 cs_blend_f_val_vector(blencp,
3460 pir,
3461 pifri);
3462 cs_blend_f_val_vector(blencp,
3463 pj,
3464 pjfri);
3465 cs_blend_f_val_vector(blencp,
3466 pjr,
3467 pjfrj);
3468
3469 /* If iconv=0 p*fr* are useless */
3470 } else {
3471 for (isou = 0; isou < 3; isou++) {
3472 cs_upwind_f_val(pi[isou],
3473 &pifrj[isou]);
3474 cs_upwind_f_val(pir[isou],
3475 &pifri[isou]);
3476 cs_upwind_f_val(pj[isou],
3477 &pjfri[isou]);
3478 cs_upwind_f_val(pjr[isou],
3479 &pjfrj[isou]);
3480 }
3481 }
3482
3483}
3484
3485/*----------------------------------------------------------------------------*/
3527/*----------------------------------------------------------------------------*/
3528
3529inline static void
3531 const int iconvp,
3532 const int ircflp,
3533 const int ischcp,
3534 const double relaxp,
3535 const double blencp,
3536 const double blend_st,
3537 const cs_real_t weight,
3538 const cs_real_t i_dist,
3539 const cs_real_t i_face_surf,
3540 const cs_real_3_t cell_ceni,
3541 const cs_real_3_t cell_cenj,
3542 const cs_real_3_t i_face_normal,
3543 const cs_real_3_t i_face_cog,
3544 const cs_real_3_t diipf,
3545 const cs_real_3_t djjpf,
3546 const cs_real_t i_massflux,
3547 const cs_real_63_t gradi,
3548 const cs_real_63_t gradj,
3549 const cs_real_63_t grdpai,
3550 const cs_real_63_t grdpaj,
3551 const cs_real_6_t pi,
3552 const cs_real_6_t pj,
3553 const cs_real_6_t pia,
3554 const cs_real_6_t pja,
3555 cs_real_t pifri[6],
3556 cs_real_t pifrj[6],
3557 cs_real_t pjfri[6],
3558 cs_real_t pjfrj[6],
3559 cs_real_t pip[6],
3560 cs_real_t pjp[6],
3561 cs_real_t pipr[6],
3562 cs_real_t pjpr[6])
3563{
3564 cs_real_6_t pir, pjr;
3565 cs_real_6_t recoi, recoj;
3566 cs_real_t testij, tesqck;
3567 int isou;
3568
3570 diipf,
3571 djjpf,
3572 gradi,
3573 gradj,
3574 pi,
3575 pj,
3576 recoi,
3577 recoj,
3578 pip,
3579 pjp);
3580
3582 pia,
3583 pja,
3584 recoi,
3585 recoj,
3586 pi,
3587 pj,
3588 pir,
3589 pjr,
3590 pipr,
3591 pjpr);
3592
3593 /* Convection slope test is needed only when iconv >0 */
3594 if (iconvp > 0) {
3596 pj,
3597 i_dist,
3598 i_face_surf,
3599 i_face_normal,
3600 gradi,
3601 gradj,
3602 grdpai,
3603 grdpaj,
3604 i_massflux,
3605 &testij,
3606 &tesqck);
3607
3608 for (isou = 0; isou < 6; isou++) {
3609 if (ischcp==1) {
3610
3611 /* Centered
3612 --------*/
3613
3614 cs_centered_f_val(weight,
3615 pip[isou],
3616 pjpr[isou],
3617 &pifrj[isou]);
3618 cs_centered_f_val(weight,
3619 pipr[isou],
3620 pjp[isou],
3621 &pifri[isou]);
3622 cs_centered_f_val(weight,
3623 pipr[isou],
3624 pjp[isou],
3625 &pjfri[isou]);
3626 cs_centered_f_val(weight,
3627 pip[isou],
3628 pjpr[isou],
3629 &pjfrj[isou]);
3630
3631 } else {
3632
3633 /* Second order
3634 ------------*/
3635
3636 cs_solu_f_val(cell_ceni,
3637 i_face_cog,
3638 gradi[isou],
3639 pi[isou],
3640 &pifrj[isou]);
3641 cs_solu_f_val(cell_ceni,
3642 i_face_cog,
3643 gradi[isou],
3644 pir[isou],
3645 &pifri[isou]);
3646 cs_solu_f_val(cell_cenj,
3647 i_face_cog,
3648 gradj[isou],
3649 pj[isou],
3650 &pjfri[isou]);
3651 cs_solu_f_val(cell_cenj,
3652 i_face_cog,
3653 gradj[isou],
3654 pjr[isou],
3655 &pjfrj[isou]);
3656
3657 }
3658
3659 }
3660
3661 /* Slope test: Pourcentage of upwind
3662 ----------------------------------*/
3663
3664 if (tesqck <= 0. || testij <= 0.) {
3665
3666 cs_blend_f_val_tensor(blend_st,
3667 pi,
3668 pifrj);
3669 cs_blend_f_val_tensor(blend_st,
3670 pir,
3671 pifri);
3672 cs_blend_f_val_tensor(blend_st,
3673 pj,
3674 pjfri);
3675 cs_blend_f_val_tensor(blend_st,
3676 pjr,
3677 pjfrj);
3678
3679 *upwind_switch = true;
3680
3681 }
3682
3683
3684 /* Blending
3685 --------*/
3686
3687 cs_blend_f_val_tensor(blencp,
3688 pi,
3689 pifrj);
3690 cs_blend_f_val_tensor(blencp,
3691 pir,
3692 pifri);
3693 cs_blend_f_val_tensor(blencp,
3694 pj,
3695 pjfri);
3696 cs_blend_f_val_tensor(blencp,
3697 pjr,
3698 pjfrj);
3699
3700 /* If iconv=0 p*fr* are useless */
3701 } else {
3702 for (isou = 0; isou < 6; isou++) {
3703 cs_upwind_f_val(pi[isou],
3704 &pifrj[isou]);
3705 cs_upwind_f_val(pir[isou],
3706 &pifri[isou]);
3707 cs_upwind_f_val(pj[isou],
3708 &pjfri[isou]);
3709 cs_upwind_f_val(pjr[isou],
3710 &pjfrj[isou]);
3711 }
3712 }
3713
3714}
3715
3716/*----------------------------------------------------------------------------*/
3753/*----------------------------------------------------------------------------*/
3754
3755inline static void
3757 const int iconvp,
3758 const int ircflp,
3759 const int ischcp,
3760 const double blencp,
3761 const double blend_st,
3762 const cs_real_t weight,
3763 const cs_real_t i_dist,
3764 const cs_real_t i_face_surf,
3765 const cs_real_3_t cell_ceni,
3766 const cs_real_3_t cell_cenj,
3767 const cs_real_3_t i_face_normal,
3768 const cs_real_3_t i_face_cog,
3769 const cs_real_3_t diipf,
3770 const cs_real_3_t djjpf,
3771 const cs_real_t i_massflux,
3772 const cs_real_3_t gradi,
3773 const cs_real_3_t gradj,
3774 const cs_real_3_t gradupi,
3775 const cs_real_3_t gradupj,
3776 const cs_real_3_t gradsti,
3777 const cs_real_3_t gradstj,
3778 const cs_real_t pi,
3779 const cs_real_t pj,
3780 cs_real_t *pif,
3781 cs_real_t *pjf,
3782 cs_real_t *pip,
3783 cs_real_t *pjp)
3784{
3785 CS_UNUSED(blend_st);
3786
3787 cs_real_t recoi, recoj;
3788 cs_real_t testij, tesqck;
3789
3790 *upwind_switch = false;
3791
3793 diipf,
3794 djjpf,
3795 gradi,
3796 gradj,
3797 pi,
3798 pj,
3799 &recoi,
3800 &recoj,
3801 pip,
3802 pjp);
3803
3804 /* Convection slope test is needed only when iconv >0 */
3805 if (iconvp > 0) {
3806 cs_slope_test(pi,
3807 pj,
3808 i_dist,
3809 i_face_surf,
3810 i_face_normal,
3811 gradi,
3812 gradj,
3813 gradsti,
3814 gradstj,
3815 i_massflux,
3816 &testij,
3817 &tesqck);
3818
3819 if (ischcp==1) {
3820
3821 /* Centered
3822 --------*/
3823
3824 cs_centered_f_val(weight,
3825 *pip,
3826 *pjp,
3827 pif);
3828 cs_centered_f_val(weight,
3829 *pip,
3830 *pjp,
3831 pjf);
3832
3833 } else if (ischcp == 0) {
3834
3835 /* Original SOLU
3836 --------------*/
3837
3838 cs_solu_f_val(cell_ceni,
3839 i_face_cog,
3840 gradi,
3841 pi,
3842 pif);
3843 cs_solu_f_val(cell_cenj,
3844 i_face_cog,
3845 gradj,
3846 pj,
3847 pjf);
3848
3849 } else {
3850
3851 /* SOLU
3852 -----*/
3853
3854 cs_solu_f_val(cell_ceni,
3855 i_face_cog,
3856 gradupi,
3857 pi,
3858 pif);
3859 cs_solu_f_val(cell_cenj,
3860 i_face_cog,
3861 gradupj,
3862 pj,
3863 pjf);
3864
3865 }
3866
3867 /* Slope test: Pourcentage of upwind
3868 ----------------------------------*/
3869
3870 if (tesqck<=0. || testij<=0.) {
3871
3872 cs_blend_f_val(blend_st,
3873 pi,
3874 pif);
3875 cs_blend_f_val(blend_st,
3876 pj,
3877 pjf);
3878
3879 *upwind_switch = true;
3880
3881 }
3882
3883 /* Blending
3884 --------*/
3885
3886 cs_blend_f_val(blencp,
3887 pi,
3888 pif);
3889 cs_blend_f_val(blencp,
3890 pj,
3891 pjf);
3892
3893 /* If iconv=0 p*f are useless */
3894 } else {
3895 cs_upwind_f_val(pi,
3896 pif);
3897 cs_upwind_f_val(pj,
3898 pjf);
3899 }
3900
3901}
3902
3903/*----------------------------------------------------------------------------*/
3914/*----------------------------------------------------------------------------*/
3915
3916inline static void
3918 const cs_lnum_t jj,
3919 const cs_real_t i_massflux,
3920 cs_lnum_t *ic,
3921 cs_lnum_t *id)
3922{
3923 if (i_massflux >= 0.) {
3924 *ic = ii;
3925 *id = jj;
3926 } else {
3927 *ic = jj;
3928 *id = ii;
3929 }
3930}
3931
3932/*----------------------------------------------------------------------------*/
3952/*----------------------------------------------------------------------------*/
3953
3954inline static void
3956 const cs_real_3_t cell_cen_c,
3957 const cs_real_3_t cell_cen_d,
3958 const cs_real_3_t i_face_normal,
3959 const cs_real_3_t i_face_cog,
3960 const cs_real_3_t gradv_c,
3961 const cs_real_t p_c,
3962 const cs_real_t p_d,
3963 const cs_real_t local_max_c,
3964 const cs_real_t local_min_c,
3965 const cs_real_t courant_c,
3966 cs_real_t *pif,
3967 cs_real_t *pjf)
3968{
3969 /* distance between face center and central cell center */
3970 cs_real_t dist_fc;
3971 cs_real_3_t nfc;
3972 cs_math_3_length_unitv(cell_cen_c, i_face_cog, &dist_fc, nfc);
3973
3974 /* unit vector and distance between central and downwind cells centers */
3975 cs_real_t dist_dc;
3976 cs_real_3_t ndc;
3977 cs_math_3_length_unitv(cell_cen_c, cell_cen_d, &dist_dc, ndc);
3978
3979 /* Place the upwind point on the line that joins
3980 the two cells on the upwind side and the same
3981 distance as that between the two cells */
3982 const cs_real_t dist_cu = dist_dc;
3983 const cs_real_t dist_du = dist_dc + dist_cu;
3984
3985 /* Compute the property on the upwind assuming a parabolic
3986 variation of the property between the two cells */
3987 const cs_real_t gradc = cs_math_3_dot_product(gradv_c, ndc);
3988
3989 const cs_real_t grad2c = ((p_d - p_c)/dist_dc - gradc)/dist_dc;
3990
3991 cs_real_t p_u = p_c + (grad2c*dist_cu - gradc)*dist_cu;
3992 p_u = CS_MAX(CS_MIN(p_u, local_max_c), local_min_c);
3993
3994 /* Compute the normalised distances */
3995 const cs_real_t nvf_r_f = (dist_fc+dist_cu)/dist_du;
3996 const cs_real_t nvf_r_c = dist_cu/dist_du;
3997
3998 /* Check for the bounds of the NVD diagram and compute the face
3999 property according to the selected NVD scheme */
4000 const cs_real_t _small = cs_math_epzero
4001 * (CS_ABS(p_u)+CS_ABS(p_c)+CS_ABS(p_d));
4002
4003 if (CS_ABS(p_d-p_u) <= _small) {
4004 *pif = p_c;
4005 *pjf = p_c;
4006 } else {
4007 const cs_real_t nvf_p_c = (p_c - p_u)/(p_d - p_u);
4008
4009 if (nvf_p_c <= 0. || nvf_p_c >= 1.) {
4010 *pif = p_c;
4011 *pjf = p_c;
4012 } else {
4013 cs_real_t nvf_p_f;
4014
4015 /* Highly compressive NVD scheme for VOF */
4016 if (limiter >= CS_NVD_VOF_HRIC) {
4017 nvf_p_f = cs_nvd_vof_scheme_scalar(limiter,
4018 i_face_normal,
4019 nvf_p_c,
4020 nvf_r_f,
4021 nvf_r_c,
4022 gradv_c,
4023 courant_c);
4024 } else { /* Regular NVD scheme */
4025 nvf_p_f = cs_nvd_scheme_scalar(limiter,
4026 nvf_p_c,
4027 nvf_r_f,
4028 nvf_r_c);
4029 }
4030
4031 *pif = p_u + nvf_p_f*(p_d - p_u);
4032 *pif = CS_MAX(CS_MIN(*pif, local_max_c), local_min_c);
4033 *pjf = *pif;
4034 }
4035 }
4036}
4037
4038/*----------------------------------------------------------------------------*/
4070/*----------------------------------------------------------------------------*/
4071
4072inline static void
4074 const int iconvp,
4075 const int ircflp,
4076 const int ischcp,
4077 const double blencp,
4078 const cs_real_t weight,
4079 const cs_real_t i_dist,
4080 const cs_real_t i_face_surf,
4081 const cs_real_3_t cell_ceni,
4082 const cs_real_3_t cell_cenj,
4083 const cs_real_3_t i_face_normal,
4084 const cs_real_3_t i_face_cog,
4085 const cs_real_3_t diipf,
4086 const cs_real_3_t djjpf,
4087 const cs_real_t i_massflux,
4088 const cs_real_33_t gradi,
4089 const cs_real_33_t gradj,
4090 const cs_real_33_t grdpai,
4091 const cs_real_33_t grdpaj,
4092 const cs_real_3_t pi,
4093 const cs_real_3_t pj,
4094 cs_real_t pif[3],
4095 cs_real_t pjf[3],
4096 cs_real_t pip[3],
4097 cs_real_t pjp[3])
4098{
4099 cs_real_3_t recoi, recoj;
4100 cs_real_t distf, srfan;
4101 cs_real_3_t testij, tesqck;
4102 int isou;
4103
4104 distf = i_dist;
4105 srfan = i_face_surf;
4106
4108 diipf,
4109 djjpf,
4110 gradi,
4111 gradj,
4112 pi,
4113 pj,
4114 recoi,
4115 recoj,
4116 pip,
4117 pjp);
4118
4119 /* Convection slope test is needed only when iconv >0 */
4120 if (iconvp > 0) {
4122 pj,
4123 distf,
4124 srfan,
4125 i_face_normal,
4126 gradi,
4127 gradj,
4128 grdpai,
4129 grdpaj,
4130 i_massflux,
4131 testij,
4132 tesqck);
4133
4134 /* FIXME: slope test should be done for the vector and not component by
4135 * component. This is conserved for compatibility only. */
4136 for (isou = 0; isou < 3; isou++) {
4137 if (tesqck[isou]<=0. || testij[isou]<=0.) {
4138
4139 /* Upwind
4140 --------*/
4141
4142 cs_upwind_f_val(pi[isou],
4143 &pif[isou]);
4144 cs_upwind_f_val(pj[isou],
4145 &pjf[isou]);
4146
4147 *upwind_switch = true;
4148
4149 } else {
4150
4151 if (ischcp==1) {
4152
4153 /* Centered
4154 --------*/
4155
4156 cs_centered_f_val(weight,
4157 pip[isou],
4158 pjp[isou],
4159 &pif[isou]);
4160 cs_centered_f_val(weight,
4161 pip[isou],
4162 pjp[isou],
4163 &pjf[isou]);
4164
4165 } else {
4166
4167 /* Second order
4168 ------------*/
4169
4170 cs_solu_f_val(cell_ceni,
4171 i_face_cog,
4172 gradi[isou],
4173 pi[isou],
4174 &pif[isou]);
4175 cs_solu_f_val(cell_cenj,
4176 i_face_cog,
4177 gradj[isou],
4178 pj[isou],
4179 &pjf[isou]);
4180
4181 }
4182 }
4183 }
4184
4185 /* Blending
4186 --------*/
4187 cs_blend_f_val_vector(blencp,
4188 pi,
4189 pif);
4190 cs_blend_f_val_vector(blencp,
4191 pj,
4192 pjf);
4193
4194 /* If iconv=0 p*f are useless */
4195 } else {
4196
4197 for (isou = 0; isou < 3; isou++) {
4198 cs_upwind_f_val(pi[isou],
4199 &pif[isou]);
4200 cs_upwind_f_val(pj[isou],
4201 &pjf[isou]);
4202
4203 }
4204 }
4205}
4206
4207
4208/*----------------------------------------------------------------------------*/
4243/*----------------------------------------------------------------------------*/
4244
4245inline static void
4247 const int iconvp,
4248 const int ircflp,
4249 const int ischcp,
4250 const double blencp,
4251 const double blend_st,
4252 const cs_real_t weight,
4253 const cs_real_t i_dist,
4254 const cs_real_t i_face_surf,
4255 const cs_real_3_t cell_ceni,
4256 const cs_real_3_t cell_cenj,
4257 const cs_real_3_t i_face_normal,
4258 const cs_real_3_t i_face_cog,
4259 const cs_real_3_t diipf,
4260 const cs_real_3_t djjpf,
4261 const cs_real_t i_massflux,
4262 const cs_real_33_t gradi,
4263 const cs_real_33_t gradj,
4264 const cs_real_33_t grdpai,
4265 const cs_real_33_t grdpaj,
4266 const cs_real_3_t pi,
4267 const cs_real_3_t pj,
4268 cs_real_t pif[3],
4269 cs_real_t pjf[3],
4270 cs_real_t pip[3],
4271 cs_real_t pjp[3])
4272{
4273 cs_real_3_t recoi, recoj;
4274 cs_real_t testij, tesqck;
4275
4277 diipf,
4278 djjpf,
4279 gradi,
4280 gradj,
4281 pi,
4282 pj,
4283 recoi,
4284 recoj,
4285 pip,
4286 pjp);
4287
4288 /* Convection slope test is needed only when iconv >0 */
4289 if (iconvp > 0) {
4291 pj,
4292 i_dist,
4293 i_face_surf,
4294 i_face_normal,
4295 gradi,
4296 gradj,
4297 grdpai,
4298 grdpaj,
4299 i_massflux,
4300 &testij,
4301 &tesqck);
4302
4303 for (int isou = 0; isou < 3; isou++) {
4304 if (ischcp == 1) {
4305
4306 /* Centered
4307 --------*/
4308
4309 cs_centered_f_val(weight,
4310 pip[isou],
4311 pjp[isou],
4312 &pif[isou]);
4313 cs_centered_f_val(weight,
4314 pip[isou],
4315 pjp[isou],
4316 &pjf[isou]);
4317
4318 } else {
4319
4320 /* Second order
4321 ------------*/
4322
4323 cs_solu_f_val(cell_ceni,
4324 i_face_cog,
4325 gradi[isou],
4326 pi[isou],
4327 &pif[isou]);
4328 cs_solu_f_val(cell_cenj,
4329 i_face_cog,
4330 gradj[isou],
4331 pj[isou],
4332 &pjf[isou]);
4333
4334 }
4335
4336 }
4337
4338 /* Slope test: Pourcentage of upwind
4339 ----------------------------------*/
4340
4341 if (tesqck <= 0. || testij <= 0.) {
4342
4343 cs_blend_f_val_vector(blend_st,
4344 pi,
4345 pif);
4346 cs_blend_f_val_vector(blend_st,
4347 pj,
4348 pjf);
4349
4350 *upwind_switch = true;
4351
4352 }
4353
4354
4355 /* Blending
4356 --------*/
4357 cs_blend_f_val_vector(blencp,
4358 pi,
4359 pif);
4360 cs_blend_f_val_vector(blencp,
4361 pj,
4362 pjf);
4363
4364 /* If iconv=0 p*f are useless */
4365 } else {
4366
4367 for (int isou = 0; isou < 3; isou++) {
4368 cs_upwind_f_val(pi[isou],
4369 &pif[isou]);
4370 cs_upwind_f_val(pj[isou],
4371 &pjf[isou]);
4372
4373 }
4374 }
4375
4376}
4377
4378/*----------------------------------------------------------------------------*/
4413/*----------------------------------------------------------------------------*/
4414
4415inline static void
4417 const int iconvp,
4418 const int ircflp,
4419 const int ischcp,
4420 const double blencp,
4421 const double blend_st,
4422 const cs_real_t weight,
4423 const cs_real_t i_dist,
4424 const cs_real_t i_face_surf,
4425 const cs_real_3_t cell_ceni,
4426 const cs_real_3_t cell_cenj,
4427 const cs_real_3_t i_face_normal,
4428 const cs_real_3_t i_face_cog,
4429 const cs_real_3_t diipf,
4430 const cs_real_3_t djjpf,
4431 const cs_real_t i_massflux,
4432 const cs_real_63_t gradi,
4433 const cs_real_63_t gradj,
4434 const cs_real_63_t grdpai,
4435 const cs_real_63_t grdpaj,
4436 const cs_real_6_t pi,
4437 const cs_real_6_t pj,
4438 cs_real_t pif[6],
4439 cs_real_t pjf[6],
4440 cs_real_t pip[6],
4441 cs_real_t pjp[6])
4442{
4443 cs_real_6_t recoi, recoj;
4444 cs_real_t testij, tesqck;
4445 int isou;
4446
4448 diipf,
4449 djjpf,
4450 gradi,
4451 gradj,
4452 pi,
4453 pj,
4454 recoi,
4455 recoj,
4456 pip,
4457 pjp);
4458
4459 /* Convection slope test is needed only when iconv >0 */
4460 if (iconvp > 0) {
4462 pj,
4463 i_dist,
4464 i_face_surf,
4465 i_face_normal,
4466 gradi,
4467 gradj,
4468 grdpai,
4469 grdpaj,
4470 i_massflux,
4471 &testij,
4472 &tesqck);
4473
4474 for (isou = 0; isou < 6; isou++) {
4475
4476 if (ischcp==1) {
4477
4478 /* Centered
4479 --------*/
4480
4481 cs_centered_f_val(weight,
4482 pip[isou],
4483 pjp[isou],
4484 &pif[isou]);
4485 cs_centered_f_val(weight,
4486 pip[isou],
4487 pjp[isou],
4488 &pjf[isou]);
4489
4490 } else {
4491
4492 /* Second order
4493 ------------*/
4494
4495 cs_solu_f_val(cell_ceni,
4496 i_face_cog,
4497 gradi[isou],
4498 pi[isou],
4499 &pif[isou]);
4500 cs_solu_f_val(cell_cenj,
4501 i_face_cog,
4502 gradj[isou],
4503 pj[isou],
4504 &pjf[isou]);
4505 }
4506
4507 }
4508
4509 /* Slope test activated: poucentage of upwind */
4510 if (tesqck <= 0. || testij <= 0.) {
4511
4512 /* Upwind
4513 --------*/
4514
4515 cs_blend_f_val_tensor(blend_st,
4516 pi,
4517 pif);
4518 cs_blend_f_val_tensor(blend_st,
4519 pj,
4520 pjf);
4521
4522 *upwind_switch = true;
4523 }
4524
4525
4526 /* Blending
4527 --------*/
4528
4529 cs_blend_f_val_tensor(blencp,
4530 pi,
4531 pif);
4532 cs_blend_f_val_tensor(blencp,
4533 pj,
4534 pjf);
4535
4536 /* If iconv=0 p*fr* are useless */
4537 } else {
4538
4539 for (isou = 0; isou < 6; isou++) {
4540 cs_upwind_f_val(pi[isou],
4541 &pif[isou]);
4542 cs_upwind_f_val(pj[isou],
4543 &pjf[isou]);
4544 }
4545 }
4546}
4547
4548/*----------------------------------------------------------------------------*/
4557/*----------------------------------------------------------------------------*/
4558
4559inline static void
4561 const cs_real_3_t gradi,
4562 const int ircflp,
4563 cs_real_t *recoi)
4564{
4565 *recoi = ircflp * ( gradi[0]*diipb[0]
4566 + gradi[1]*diipb[1]
4567 + gradi[2]*diipb[2]);
4568}
4569
4570/*----------------------------------------------------------------------------*/
4579/*----------------------------------------------------------------------------*/
4580
4581inline static void
4583 const cs_real_33_t gradi,
4584 const int ircflp,
4585 cs_real_t recoi[3])
4586{
4587 for (int isou = 0; isou < 3; isou++) {
4588 recoi[isou] = ircflp * ( gradi[isou][0]*diipb[0]
4589 + gradi[isou][1]*diipb[1]
4590 + gradi[isou][2]*diipb[2]);
4591 }
4592}
4593
4594/*----------------------------------------------------------------------------*/
4603/*----------------------------------------------------------------------------*/
4604
4605inline static void
4607 const cs_real_63_t gradi,
4608 const int ircflp,
4609 cs_real_t recoi[6])
4610{
4611 for (int isou = 0; isou < 6; isou++) {
4612 recoi[isou] = ircflp * (gradi[isou][0]*diipb[0]
4613 + gradi[isou][1]*diipb[1]
4614 + gradi[isou][2]*diipb[2]);
4615 }
4616}
4617
4618/*----------------------------------------------------------------------------*/
4629/*----------------------------------------------------------------------------*/
4630
4631inline static void
4632cs_b_relax_c_val(const double relaxp,
4633 const cs_real_t pi,
4634 const cs_real_t pia,
4635 const cs_real_t recoi,
4636 cs_real_t *pir,
4637 cs_real_t *pipr)
4638{
4639 *pir = pi/relaxp - (1.-relaxp)/relaxp*pia;
4640 *pipr = *pir + recoi;
4641}
4642
4643/*----------------------------------------------------------------------------*/
4654/*----------------------------------------------------------------------------*/
4655
4656inline static void
4657cs_b_relax_c_val_vector(const double relaxp,
4658 const cs_real_3_t pi,
4659 const cs_real_3_t pia,
4660 const cs_real_3_t recoi,
4661 cs_real_t pir[3],
4662 cs_real_t pipr[3])
4663{
4664 for (int isou = 0; isou < 3; isou++) {
4665 pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4666 pipr[isou] = pir[isou] + recoi[isou];
4667 }
4668}
4669
4670/*----------------------------------------------------------------------------*/
4681/*----------------------------------------------------------------------------*/
4682
4683inline static void
4684cs_b_relax_c_val_tensor(const double relaxp,
4685 const cs_real_6_t pi,
4686 const cs_real_6_t pia,
4687 const cs_real_6_t recoi,
4688 cs_real_t pir[6],
4689 cs_real_t pipr[6])
4690{
4691 for (int isou = 0; isou < 6; isou++) {
4692 pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4693 pipr[isou] = pir[isou] + recoi[isou];
4694 }
4695}
4696
4697/*----------------------------------------------------------------------------*/
4721/*----------------------------------------------------------------------------*/
4722
4723inline static void
4725 cs_real_t thetap,
4726 int imasac,
4727 int inc,
4728 cs_int_t bc_type,
4729 int icvfli,
4730 cs_real_t pi,
4731 cs_real_t pir,
4732 cs_real_t pipr,
4733 cs_real_t coefap,
4734 cs_real_t coefbp,
4735 cs_real_t coface,
4736 cs_real_t cofbce,
4737 cs_real_t b_massflux,
4738 cs_real_t xcpp,
4739 cs_real_t *flux)
4740{
4741 cs_real_t flui, fluj, pfac;
4742
4743 /* Computed convective flux */
4744
4745 if (icvfli == 0) {
4746
4747 /* Remove decentering for coupled faces */
4748 if (bc_type == CS_COUPLED_FD) {
4749 flui = 0.0;
4750 fluj = b_massflux;
4751 } else {
4752 flui = 0.5*(b_massflux +fabs(b_massflux));
4753 fluj = 0.5*(b_massflux -fabs(b_massflux));
4754 }
4755
4756 pfac = inc*coefap + coefbp*pipr;
4757 *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4758
4759 /* Imposed convective flux */
4760
4761 } else {
4762
4763 pfac = inc*coface + cofbce*pipr;
4764 *flux += iconvp*xcpp*(-imasac*(b_massflux*pi) + thetap*(pfac));
4765
4766 }
4767}
4768
4769/*----------------------------------------------------------------------------*/
4791/*----------------------------------------------------------------------------*/
4792
4793inline static void
4795 cs_real_t thetap,
4796 int imasac,
4797 int inc,
4798 cs_int_t bc_type,
4799 int icvfli,
4800 const cs_real_t pi[restrict 3],
4801 const cs_real_t pir[restrict 3],
4802 const cs_real_t pipr[restrict 3],
4803 const cs_real_t coefap[restrict 3],
4804 const cs_real_t coefbp[restrict 3][3],
4805 const cs_real_t coface[restrict 3],
4806 const cs_real_t cofbce[restrict 3][3],
4807 cs_real_t b_massflux,
4808 cs_real_t flux[restrict 3])
4809{
4810 cs_real_t flui, fluj, pfac;
4811
4812 /* Computed convective flux */
4813
4814 if (icvfli == 0) {
4815
4816 /* Remove decentering for coupled faces */
4817 if (bc_type == CS_COUPLED_FD) {
4818 flui = 0.0;
4819 fluj = b_massflux;
4820 } else {
4821 flui = 0.5*(b_massflux +fabs(b_massflux));
4822 fluj = 0.5*(b_massflux -fabs(b_massflux));
4823 }
4824 for (int isou = 0; isou < 3; isou++) {
4825 pfac = inc*coefap[isou];
4826 for (int jsou = 0; jsou < 3; jsou++) {
4827 pfac += coefbp[isou][jsou]*pipr[jsou];
4828 }
4829 flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4830 - imasac*b_massflux*pi[isou]);
4831 }
4832
4833 /* Imposed convective flux */
4834
4835 } else {
4836
4837 for (int isou = 0; isou < 3; isou++) {
4838 pfac = inc*coface[isou];
4839 for (int jsou = 0; jsou < 3; jsou++) {
4840 pfac += cofbce[isou][jsou]*pipr[jsou];
4841 }
4842 flux[isou] += iconvp*( thetap*pfac
4843 - imasac*b_massflux*pi[isou]);
4844 }
4845
4846 }
4847}
4848
4849/*----------------------------------------------------------------------------*/
4869/*----------------------------------------------------------------------------*/
4870
4871inline static void
4872cs_b_upwind_flux(const int iconvp,
4873 const cs_real_t thetap,
4874 const int imasac,
4875 const int inc,
4876 const int bc_type,
4877 const cs_real_t pi,
4878 const cs_real_t pir,
4879 const cs_real_t pipr,
4880 const cs_real_t coefap,
4881 const cs_real_t coefbp,
4882 const cs_real_t b_massflux,
4883 const cs_real_t xcpp,
4884 cs_real_t *flux)
4885{
4886 cs_real_t flui, fluj, pfac;
4887
4888 /* Remove decentering for coupled faces */
4889 if (bc_type == CS_COUPLED_FD) {
4890 flui = 0.0;
4891 fluj = b_massflux;
4892 } else {
4893 flui = 0.5*(b_massflux +fabs(b_massflux));
4894 fluj = 0.5*(b_massflux -fabs(b_massflux));
4895 }
4896
4897 pfac = inc*coefap + coefbp*pipr;
4898 *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4899}
4900
4901/*----------------------------------------------------------------------------*/
4921/*----------------------------------------------------------------------------*/
4922
4923inline static void
4925 const cs_real_t thetap,
4926 const int imasac,
4927 const int inc,
4928 const int bc_type,
4929 const cs_real_3_t pi,
4930 const cs_real_3_t pir,
4931 const cs_real_3_t pipr,
4932 const cs_real_3_t coefa,
4933 const cs_real_33_t coefb,
4934 const cs_real_t b_massflux,
4935 cs_real_t flux[3])
4936{
4937 cs_real_t flui, fluj, pfac;
4938
4939 /* Remove decentering for coupled faces */
4940 if (bc_type == CS_COUPLED_FD) {
4941 flui = 0.0;
4942 fluj = b_massflux;
4943 } else {
4944 flui = 0.5*(b_massflux +fabs(b_massflux));
4945 fluj = 0.5*(b_massflux -fabs(b_massflux));
4946 }
4947 for (int isou = 0; isou < 3; isou++) {
4948 pfac = inc*coefa[isou];
4949 for (int jsou = 0; jsou < 3; jsou++) {
4950 pfac += coefb[isou][jsou]*pipr[jsou];
4951 }
4952 flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4953 - imasac*b_massflux*pi[isou]);
4954 }
4955}
4956
4957/*----------------------------------------------------------------------------*/
4977/*----------------------------------------------------------------------------*/
4978
4979inline static void
4981 const cs_real_t thetap,
4982 const int imasac,
4983 const int inc,
4984 const int bc_type,
4985 const cs_real_6_t pi,
4986 const cs_real_6_t pir,
4987 const cs_real_6_t pipr,
4988 const cs_real_6_t coefa,
4989 const cs_real_66_t coefb,
4990 const cs_real_t b_massflux,
4991 cs_real_t flux[6])
4992{
4993 cs_real_t flui, fluj, pfac;
4994
4995 /* Remove decentering for coupled faces */
4996 if (bc_type == CS_COUPLED_FD) {
4997 flui = 0.0;
4998 fluj = b_massflux;
4999 } else {
5000 flui = 0.5*(b_massflux +fabs(b_massflux));
5001 fluj = 0.5*(b_massflux -fabs(b_massflux));
5002 }
5003 for (int isou = 0; isou < 6; isou++) {
5004 pfac = inc*coefa[isou];
5005 for (int jsou = 0; jsou < 6; jsou++) {
5006 pfac += coefb[isou][jsou]*pipr[jsou];
5007 }
5008 flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
5009 - imasac*b_massflux*pi[isou]);
5010 }
5011}
5012
5013/*----------------------------------------------------------------------------*/
5026/*----------------------------------------------------------------------------*/
5027
5028inline static void
5029cs_b_diff_flux(const int idiffp,
5030 const cs_real_t thetap,
5031 const int inc,
5032 const cs_real_t pipr,
5033 const cs_real_t cofafp,
5034 const cs_real_t cofbfp,
5035 const cs_real_t b_visc,
5036 cs_real_t *flux)
5037{
5038 cs_real_t pfacd = inc*cofafp + cofbfp*pipr;
5039 *flux += idiffp*thetap*b_visc*pfacd;
5040}
5041
5042/*----------------------------------------------------------------------------*/
5055/*----------------------------------------------------------------------------*/
5056
5057inline static void
5058cs_b_diff_flux_vector(const int idiffp,
5059 const cs_real_t thetap,
5060 const int inc,
5061 const cs_real_3_t pipr,
5062 const cs_real_3_t cofaf,
5063 const cs_real_33_t cofbf,
5064 const cs_real_t b_visc,
5065 cs_real_t flux[3])
5066{
5067 cs_real_t pfacd ;
5068 for (int isou = 0; isou < 3; isou++) {
5069 pfacd = inc*cofaf[isou];
5070 for (int jsou = 0; jsou < 3; jsou++) {
5071 pfacd += cofbf[isou][jsou]*pipr[jsou];
5072 }
5073 flux[isou] += idiffp*thetap*b_visc*pfacd;
5074 }
5075}
5076
5077/*----------------------------------------------------------------------------*/
5090/*----------------------------------------------------------------------------*/
5091
5092inline static void
5093cs_b_diff_flux_tensor(const int idiffp,
5094 const cs_real_t thetap,
5095 const int inc,
5096 const cs_real_6_t pipr,
5097 const cs_real_6_t cofaf,
5098 const cs_real_66_t cofbf,
5099 const cs_real_t b_visc,
5100 cs_real_t flux[6])
5101{
5102 cs_real_t pfacd ;
5103 for (int isou = 0; isou < 6; isou++) {
5104 pfacd = inc*cofaf[isou];
5105 for (int jsou = 0; jsou < 6; jsou++) {
5106 pfacd += cofbf[isou][jsou]*pipr[jsou];
5107 }
5108 flux[isou] += idiffp*thetap*b_visc*pfacd;
5109 }
5110}
5111
5112/*----------------------------------------------------------------------------*/
5126/*----------------------------------------------------------------------------*/
5127
5128inline static void
5129cs_b_cd_steady(const int ircflp,
5130 const double relaxp,
5131 const cs_real_3_t diipb,
5132 const cs_real_3_t gradi,
5133 const cs_real_t pi,
5134 const cs_real_t pia,
5135 cs_real_t *pir,
5136 cs_real_t *pipr)
5137{
5138 cs_real_t recoi;
5139
5141 gradi,
5142 ircflp,
5143 &recoi);
5144
5145 cs_b_relax_c_val(relaxp,
5146 pi,
5147 pia,
5148 recoi,
5149 pir,
5150 pipr);
5151}
5152
5153/*----------------------------------------------------------------------------*/
5167/*----------------------------------------------------------------------------*/
5168
5169inline static void
5170cs_b_cd_steady_vector(const int ircflp,
5171 const double relaxp,
5172 const cs_real_3_t diipb,
5173 const cs_real_33_t gradi,
5174 const cs_real_3_t pi,
5175 const cs_real_3_t pia,
5176 cs_real_t pir[3],
5177 cs_real_t pipr[3])
5178{
5179 cs_real_3_t recoi;
5180
5182 gradi,
5183 ircflp,
5184 recoi);
5185
5187 pi,
5188 pia,
5189 recoi,
5190 pir,
5191 pipr);
5192}
5193
5194/*----------------------------------------------------------------------------*/
5208/*----------------------------------------------------------------------------*/
5209
5210inline static void
5211cs_b_cd_steady_tensor(const int ircflp,
5212 const double relaxp,
5213 const cs_real_3_t diipb,
5214 const cs_real_63_t gradi,
5215 const cs_real_6_t pi,
5216 const cs_real_6_t pia,
5217 cs_real_t pir[6],
5218 cs_real_t pipr[6])
5219{
5220 cs_real_6_t recoi;
5221
5223 gradi,
5224 ircflp,
5225 recoi);
5226
5228 pi,
5229 pia,
5230 recoi,
5231 pir,
5232 pipr);
5233}
5234
5235/*----------------------------------------------------------------------------*/
5246/*----------------------------------------------------------------------------*/
5247
5248inline static void
5249cs_b_cd_unsteady(const int ircflp,
5250 const cs_real_3_t diipb,
5251 const cs_real_3_t gradi,
5252 const cs_real_t pi,
5253 cs_real_t *pip)
5254{
5255 cs_real_t recoi;
5256
5258 gradi,
5259 ircflp,
5260 &recoi);
5261
5262 *pip = pi + recoi;
5263}
5264
5265/*----------------------------------------------------------------------------*/
5276/*----------------------------------------------------------------------------*/
5277
5278inline static void
5280 const cs_real_3_t diipb,
5281 const cs_real_33_t gradi,
5282 const cs_real_3_t pi,
5283 cs_real_t pip[3])
5284{
5285 cs_real_3_t recoi;
5286
5288 gradi,
5289 ircflp,
5290 recoi);
5291
5292 for (int isou = 0; isou < 3; isou++)
5293 pip[isou] = pi[isou] + recoi[isou];
5294}
5295
5296/*----------------------------------------------------------------------------*/
5307/*----------------------------------------------------------------------------*/
5308
5309inline static void
5311 const cs_real_3_t diipb,
5312 const cs_real_63_t gradi,
5313 const cs_real_6_t pi,
5314 cs_real_t pip[6])
5315{
5316 cs_real_6_t recoi;
5317
5319 gradi,
5320 ircflp,
5321 recoi);
5322
5323 for(int isou = 0; isou< 6; isou++)
5324 pip[isou] = pi[isou] + recoi[isou];
5325}
5326
5327/*----------------------------------------------------------------------------*/
5338/*----------------------------------------------------------------------------*/
5339
5340inline static void
5342 cs_real_t pi,
5343 cs_real_t pj,
5344 cs_real_t b_visc,
5345 cs_real_t *fluxi)
5346{
5347 *fluxi += idiffp*b_visc*(pi - pj);
5348}
5349
5350/*----------------------------------------------------------------------------*/
5361/*----------------------------------------------------------------------------*/
5362
5363inline static void
5365 const cs_real_t pi[3],
5366 const cs_real_t pj[3],
5367 cs_real_t b_visc,
5368 cs_real_t fluxi[3])
5369{
5370 for (int k = 0; k < 3; k++)
5371 fluxi[k] += idiffp*b_visc*(pi[k] - pj[k]);
5372}
5373
5374
5375/*============================================================================
5376 * Public function prototypes for Fortran API
5377 *============================================================================*/
5378
5379/*----------------------------------------------------------------------------
5380 * Wrapper to cs_face_diffusion_potential
5381 *----------------------------------------------------------------------------*/
5382
5383void CS_PROCF (itrmas, ITRMAS)
5384(
5385 const cs_int_t *const f_id,
5386 const cs_int_t *const init,
5387 const cs_int_t *const inc,
5388 const cs_int_t *const imrgra,
5389 const cs_int_t *const iccocg,
5390 const cs_int_t *const nswrgp,
5391 const cs_int_t *const imligp,
5392 const cs_int_t *const iphydp,
5393 const cs_int_t *const iwgrp,
5394 const cs_int_t *const iwarnp,
5395 const cs_real_t *const epsrgp,
5396 const cs_real_t *const climgp,
5397 const cs_real_t *const extrap,
5398 cs_real_3_t frcxt[],
5399 cs_real_t pvar[],
5400 const cs_real_t coefap[],
5401 const cs_real_t coefbp[],
5402 const cs_real_t cofafp[],
5403 const cs_real_t cofbfp[],
5404 const cs_real_t i_visc[],
5405 const cs_real_t b_visc[],
5406 cs_real_t visel[],
5407 cs_real_t i_massflux[],
5408 cs_real_t b_massflux[]
5409);
5410
5411/*----------------------------------------------------------------------------
5412 * Wrapper to cs_face_anisotropic_diffusion_potential
5413 *----------------------------------------------------------------------------*/
5414
5415void CS_PROCF (itrmav, ITRMAV)
5416(
5417 const cs_int_t *const f_id,
5418 const cs_int_t *const init,
5419 const cs_int_t *const inc,
5420 const cs_int_t *const imrgra,
5421 const cs_int_t *const iccocg,
5422 const cs_int_t *const nswrgp,
5423 const cs_int_t *const imligp,
5424 const cs_int_t *const ircflp,
5425 const cs_int_t *const iphydp,
5426 const cs_int_t *const iwgrp,
5427 const cs_int_t *const iwarnp,
5428 const cs_real_t *const epsrgp,
5429 const cs_real_t *const climgp,
5430 const cs_real_t *const extrap,
5431 cs_real_3_t frcxt[],
5432 cs_real_t pvar[],
5433 const cs_real_t coefap[],
5434 const cs_real_t coefbp[],
5435 const cs_real_t cofafp[],
5436 const cs_real_t cofbfp[],
5437 const cs_real_t i_visc[],
5438 const cs_real_t b_visc[],
5439 cs_real_6_t viscel[],
5440 const cs_real_2_t weighf[],
5441 const cs_real_t weighb[],
5442 cs_real_t i_massflux[],
5443 cs_real_t b_massflux[]
5444);
5445
5446/*----------------------------------------------------------------------------
5447 * Wrapper to cs_diffusion_potential
5448 *----------------------------------------------------------------------------*/
5449
5450void CS_PROCF (itrgrp, ITRGRP)
5451(
5452 const cs_int_t *const f_id,
5453 const cs_int_t *const init,
5454 const cs_int_t *const inc,
5455 const cs_int_t *const imrgra,
5456 const cs_int_t *const iccocg,
5457 const cs_int_t *const nswrgp,
5458 const cs_int_t *const imligp,
5459 const cs_int_t *const iphydp,
5460 const cs_int_t *const iwarnp,
5461 const cs_real_t *const epsrgp,
5462 const cs_real_t *const climgp,
5463 const cs_real_t *const extrap,
5464 cs_real_3_t frcxt[],
5465 cs_real_t pvar[],
5466 const cs_real_t coefap[],
5467 const cs_real_t coefbp[],
5468 const cs_real_t cofafp[],
5469 const cs_real_t cofbfp[],
5470 const cs_real_t i_visc[],
5471 const cs_real_t b_visc[],
5472 cs_real_t visel[],
5473 cs_real_t diverg[]
5474);
5475
5476/*----------------------------------------------------------------------------
5477 * Wrapper to cs_anisotropic_diffusion_potential
5478 *----------------------------------------------------------------------------*/
5479
5480void CS_PROCF (itrgrv, ITRGRV)
5481(
5482 const cs_int_t *const f_id,
5483 const cs_int_t *const init,
5484 const cs_int_t *const inc,
5485 const cs_int_t *const imrgra,
5486 const cs_int_t *const iccocg,
5487 const cs_int_t *const nswrgp,
5488 const cs_int_t *const imligp,
5489 const cs_int_t *const ircflp,
5490 const cs_int_t *const iphydp,
5491 const cs_int_t *const iwarnp,
5492 const cs_real_t *const epsrgp,
5493 const cs_real_t *const climgp,
5494 const cs_real_t *const extrap,
5495 cs_real_3_t frcxt[],
5496 cs_real_t pvar[],
5497 const cs_real_t coefap[],
5498 const cs_real_t coefbp[],
5499 const cs_real_t cofafp[],
5500 const cs_real_t cofbfp[],
5501 const cs_real_t i_visc[],
5502 const cs_real_t b_visc[],
5503 cs_real_6_t viscel[],
5504 const cs_real_2_t weighf[],
5505 const cs_real_t weighb[],
5506 cs_real_t diverg[]
5507);
5508
5509/*=============================================================================
5510 * Public function prototypes
5511 *============================================================================*/
5512
5513/*----------------------------------------------------------------------------*/
5532/*----------------------------------------------------------------------------*/
5533
5534void
5535cs_slope_test_gradient(int f_id,
5536 int inc,
5537 cs_halo_type_t halo_type,
5538 const cs_real_3_t *grad,
5539 cs_real_3_t *grdpa,
5540 const cs_real_t *pvar,
5541 const cs_real_t *coefap,
5542 const cs_real_t *coefbp,
5543 const cs_real_t *i_massflux);
5544
5545/*----------------------------------------------------------------------------*/
5561/*----------------------------------------------------------------------------*/
5562
5563void
5564cs_upwind_gradient(const int f_id,
5565 const int inc,
5566 const cs_halo_type_t halo_type,
5567 const cs_real_t coefap[],
5568 const cs_real_t coefbp[],
5569 const cs_real_t i_massflux[],
5570 const cs_real_t b_massflux[],
5571 const cs_real_t *restrict pvar,
5572 cs_real_3_t *restrict grdpa);
5573
5574/*----------------------------------------------------------------------------*/
5592/*----------------------------------------------------------------------------*/
5593
5594void
5595cs_slope_test_gradient_vector(const int inc,
5596 const cs_halo_type_t halo_type,
5597 const cs_real_33_t *grad,
5598 cs_real_33_t *grdpa,
5599 const cs_real_3_t *pvar,
5600 const cs_real_3_t *coefa,
5601 const cs_real_33_t *coefb,
5602 const cs_real_t *i_massflux);
5603
5604/*----------------------------------------------------------------------------*/
5622/*----------------------------------------------------------------------------*/
5623
5624void
5625cs_slope_test_gradient_tensor(const int inc,
5626 const cs_halo_type_t halo_type,
5627 const cs_real_63_t *grad,
5628 cs_real_63_t *grdpa,
5629 const cs_real_6_t *pvar,
5630 const cs_real_6_t *coefa,
5631 const cs_real_66_t *coefb,
5632 const cs_real_t *i_massflux);
5633
5634/*----------------------------------------------------------------------------*/
5643/*----------------------------------------------------------------------------*/
5644
5645void
5647 int inc,
5648 const cs_real_t rovsdt[]);
5649
5650/*----------------------------------------------------------------------------*/
5702/*----------------------------------------------------------------------------*/
5703
5704void
5706 int f_id,
5707 const cs_var_cal_opt_t var_cal_opt,
5708 int icvflb,
5709 int inc,
5710 int iccocg,
5711 int imasac,
5712 cs_real_t *restrict pvar,
5713 const cs_real_t *restrict pvara,
5714 const cs_int_t icvfli[],
5715 const cs_real_t coefap[],
5716 const cs_real_t coefbp[],
5717 const cs_real_t cofafp[],
5718 const cs_real_t cofbfp[],
5719 const cs_real_t i_massflux[],
5720 const cs_real_t b_massflux[],
5721 const cs_real_t i_visc[],
5722 const cs_real_t b_visc[],
5723 cs_real_t *restrict rhs);
5724
5725/*----------------------------------------------------------------------------*/
5764/*----------------------------------------------------------------------------*/
5765
5766void
5767cs_face_convection_scalar(int idtvar,
5768 int f_id,
5769 const cs_var_cal_opt_t var_cal_opt,
5770 int icvflb,
5771 int inc,
5772 int iccocg,
5773 int imasac,
5774 cs_real_t *restrict pvar,
5775 const cs_real_t *restrict pvara,
5776 const cs_int_t icvfli[],
5777 const cs_real_t coefap[],
5778 const cs_real_t coefbp[],
5779 const cs_real_t i_massflux[],
5780 const cs_real_t b_massflux[],
5781 cs_real_2_t i_conv_flux[],
5782 cs_real_t b_conv_flux[]);
5783
5784/*----------------------------------------------------------------------------*/
5844/*----------------------------------------------------------------------------*/
5845
5846void
5848 int f_id,
5849 const cs_var_cal_opt_t var_cal_opt,
5850 int icvflb,
5851 int inc,
5852 int ivisep,
5853 int imasac,
5854 cs_real_3_t *restrict pvar,
5855 const cs_real_3_t *restrict pvara,
5856 const cs_int_t icvfli[],
5857 const cs_real_3_t coefav[],
5858 const cs_real_33_t coefbv[],
5859 const cs_real_3_t cofafv[],
5860 const cs_real_33_t cofbfv[],
5861 const cs_real_t i_massflux[],
5862 const cs_real_t b_massflux[],
5863 const cs_real_t i_visc[],
5864 const cs_real_t b_visc[],
5865 const cs_real_t secvif[],
5866 const cs_real_t secvib[],
5867 cs_real_3_t *restrict rhs);
5868
5869/*----------------------------------------------------------------------------*/
5914/*----------------------------------------------------------------------------*/
5915
5916void
5918 int f_id,
5919 const cs_var_cal_opt_t var_cal_opt,
5920 int icvflb,
5921 int inc,
5922 int imasac,
5923 cs_real_6_t *restrict pvar,
5924 const cs_real_6_t *restrict pvara,
5925 const cs_real_6_t coefa[],
5926 const cs_real_66_t coefb[],
5927 const cs_real_6_t cofaf[],
5928 const cs_real_66_t cofbf[],
5929 const cs_real_t i_massflux[],
5930 const cs_real_t b_massflux[],
5931 const cs_real_t i_visc[],
5932 const cs_real_t b_visc[],
5933 cs_real_6_t *restrict rhs);
5934
5935/*----------------------------------------------------------------------------*/
5981/*----------------------------------------------------------------------------*/
5982
5983void
5985 int f_id,
5986 const cs_var_cal_opt_t var_cal_opt,
5987 int inc,
5988 int iccocg,
5989 int imasac,
5990 cs_real_t *restrict pvar,
5991 const cs_real_t *restrict pvara,
5992 const cs_real_t coefap[],
5993 const cs_real_t coefbp[],
5994 const cs_real_t cofafp[],
5995 const cs_real_t cofbfp[],
5996 const cs_real_t i_massflux[],
5997 const cs_real_t b_massflux[],
5998 const cs_real_t i_visc[],
5999 const cs_real_t b_visc[],
6000 const cs_real_t xcpp[],
6001 cs_real_t *restrict rhs);
6002
6003/*----------------------------------------------------------------------------*/
6051/*----------------------------------------------------------------------------*/
6052
6053void
6055 int f_id,
6056 const cs_var_cal_opt_t var_cal_opt,
6057 int inc,
6058 int iccocg,
6059 cs_real_t *restrict pvar,
6060 const cs_real_t *restrict pvara,
6061 const cs_real_t coefap[],
6062 const cs_real_t coefbp[],
6063 const cs_real_t cofafp[],
6064 const cs_real_t cofbfp[],
6065 const cs_real_t i_visc[],
6066 const cs_real_t b_visc[],
6067 cs_real_6_t *restrict viscel,
6068 const cs_real_2_t weighf[],
6069 const cs_real_t weighb[],
6070 cs_real_t *restrict rhs);
6071
6072/*-----------------------------------------------------------------------------*/
6122/*----------------------------------------------------------------------------*/
6123
6124void
6126 int f_id,
6127 const cs_var_cal_opt_t var_cal_opt,
6128 int inc,
6129 int ivisep,
6130 cs_real_3_t *restrict pvar,
6131 const cs_real_3_t *restrict pvara,
6132 const cs_real_3_t coefav[],
6133 const cs_real_33_t coefbv[],
6134 const cs_real_3_t cofafv[],
6135 const cs_real_33_t cofbfv[],
6136 const cs_real_33_t i_visc[],
6137 const cs_real_t b_visc[],
6138 const cs_real_t secvif[],
6139 cs_real_3_t *restrict rhs);
6140
6141/*-----------------------------------------------------------------------------*/
6186/*----------------------------------------------------------------------------*/
6187
6188void
6190 int f_id,
6191 const cs_var_cal_opt_t var_cal_opt,
6192 int inc,
6193 cs_real_3_t *restrict pvar,
6194 const cs_real_3_t *restrict pvara,
6195 const cs_real_3_t coefav[],
6196 const cs_real_33_t coefbv[],
6197 const cs_real_3_t cofafv[],
6198 const cs_real_33_t cofbfv[],
6199 const cs_real_t i_visc[],
6200 const cs_real_t b_visc[],
6201 cs_real_6_t *restrict viscel,
6202 const cs_real_2_t weighf[],
6203 const cs_real_t weighb[],
6204 cs_real_3_t *restrict rhs);
6205
6206/*----------------------------------------------------------------------------*/
6250/*----------------------------------------------------------------------------*/
6251
6252void
6254 int f_id,
6255 const cs_var_cal_opt_t var_cal_opt,
6256 int inc,
6257 cs_real_6_t *restrict pvar,
6258 const cs_real_6_t *restrict pvara,
6259 const cs_real_6_t coefa[],
6260 const cs_real_66_t coefb[],
6261 const cs_real_6_t cofaf[],
6262 const cs_real_66_t cofbf[],
6263 const cs_real_t i_visc[],
6264 const cs_real_t b_visc[],
6265 cs_real_6_t *restrict viscel,
6266 const cs_real_2_t weighf[],
6267 const cs_real_t weighb[],
6268 cs_real_6_t *restrict rhs);
6269
6270/*----------------------------------------------------------------------------*/
6330/*----------------------------------------------------------------------------*/
6331
6332void
6333cs_face_diffusion_potential(const int f_id,
6334 const cs_mesh_t *m,
6336 int init,
6337 int inc,
6338 int imrgra,
6339 int iccocg,
6340 int nswrgp,
6341 int imligp,
6342 int iphydp,
6343 int iwgrp,
6344 int iwarnp,
6345 double epsrgp,
6346 double climgp,
6347 double extrap,
6348 cs_real_3_t *restrict frcxt,
6349 cs_real_t *restrict pvar,
6350 const cs_real_t coefap[],
6351 const cs_real_t coefbp[],
6352 const cs_real_t cofafp[],
6353 const cs_real_t cofbfp[],
6354 const cs_real_t i_visc[],
6355 const cs_real_t b_visc[],
6356 cs_real_t *restrict visel,
6357 cs_real_t *restrict i_massflux,
6358 cs_real_t *restrict b_massflux);
6359
6360/*----------------------------------------------------------------------------*/
6431/*----------------------------------------------------------------------------*/
6432
6433void
6435 const cs_mesh_t *m,
6437 int init,
6438 int inc,
6439 int imrgra,
6440 int iccocg,
6441 int nswrgp,
6442 int imligp,
6443 int ircflp,
6444 int iphydp,
6445 int iwgrp,
6446 int iwarnp,
6447 double epsrgp,
6448 double climgp,
6449 double extrap,
6450 cs_real_3_t *restrict frcxt,
6451 cs_real_t *restrict pvar,
6452 const cs_real_t coefap[],
6453 const cs_real_t coefbp[],
6454 const cs_real_t cofafp[],
6455 const cs_real_t cofbfp[],
6456 const cs_real_t i_visc[],
6457 const cs_real_t b_visc[],
6458 cs_real_6_t *restrict viscel,
6459 const cs_real_2_t weighf[],
6460 const cs_real_t weighb[],
6461 cs_real_t *restrict i_massflux,
6462 cs_real_t *restrict b_massflux);
6463
6464/*----------------------------------------------------------------------------*/
6520/*----------------------------------------------------------------------------*/
6521
6522void
6523cs_diffusion_potential(const int f_id,
6524 const cs_mesh_t *m,
6526 int init,
6527 int inc,
6528 int imrgra,
6529 int iccocg,
6530 int nswrgp,
6531 int imligp,
6532 int iphydp,
6533 int iwarnp,
6534 double epsrgp,
6535 double climgp,
6536 double extrap,
6537 cs_real_3_t *restrict frcxt,
6538 cs_real_t *restrict pvar,
6539 const cs_real_t coefap[],
6540 const cs_real_t coefbp[],
6541 const cs_real_t cofafp[],
6542 const cs_real_t cofbfp[],
6543 const cs_real_t i_visc[],
6544 const cs_real_t b_visc[],
6545 cs_real_t visel[],
6546 cs_real_t *restrict diverg);
6547
6548/*----------------------------------------------------------------------------*/
6617/*----------------------------------------------------------------------------*/
6618
6619void
6621 const cs_mesh_t *m,
6623 int init,
6624 int inc,
6625 int imrgra,
6626 int iccocg,
6627 int nswrgp,
6628 int imligp,
6629 int ircflp,
6630 int iphydp,
6631 int iwarnp,
6632 double epsrgp,
6633 double climgp,
6634 double extrap,
6635 cs_real_3_t *restrict frcxt,
6636 cs_real_t *restrict pvar,
6637 const cs_real_t coefap[],
6638 const cs_real_t coefbp[],
6639 const cs_real_t cofafp[],
6640 const cs_real_t cofbfp[],
6641 const cs_real_t i_visc[],
6642 const cs_real_t b_visc[],
6643 cs_real_6_t *restrict viscel,
6644 const cs_real_2_t weighf[],
6645 const cs_real_t weighb[],
6646 cs_real_t *restrict diverg);
6647
6648/*----------------------------------------------------------------------------*/
6649
6651
6652#endif /* __CS_CONVECTION_DIFFUSION_H__ */
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:1052
void itrmav(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const ircflp, const cs_int_t *const iphydp, const cs_int_t *const iwgrp, const cs_int_t *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t viscel[], const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t i_massflux[], cs_real_t b_massflux[])
Definition cs_convection_diffusion.c:719
void itrgrv(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const ircflp, const cs_int_t *const iphydp, const cs_int_t *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t viscel[], const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t diverg[])
Definition cs_convection_diffusion.c:847
static void cs_i_cd_steady_upwind(const int ircflp, 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:1499
void cs_anisotropic_diffusion_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int iccocg, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict rhs)
Add the explicit part of the diffusion terms with a symmetric tensor diffusivity for a transport equa...
Definition cs_convection_diffusion.c:7622
static void cs_i_cd_steady_slope_test(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_3_t gradsti, const cs_real_3_t gradstj, const cs_real_t pi, const cs_real_t pj, const cs_real_t pia, const cs_real_t pja, cs_real_t *pifri, cs_real_t *pifrj, cs_real_t *pjfri, cs_real_t *pjfrj, cs_real_t *pip, cs_real_t *pjp, cs_real_t *pipr, cs_real_t *pjpr)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition cs_convection_diffusion.h:2822
static void cs_i_cd_steady_vector(const int ircflp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition cs_convection_diffusion.h:2089
void cs_face_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int iccocg, int nswrgp, int imligp, int ircflp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, double extrap, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict i_massflux, cs_real_t *restrict b_massflux)
Add the explicit part of the pressure gradient term to the mass flux in case of anisotropic diffusion...
Definition cs_convection_diffusion.c:10467
static void cs_i_cd_unsteady_upwind(const int ircflp, 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:1741
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 normalised face scalar using the specified NVD scheme.
Definition cs_convection_diffusion.h:126
static void cs_i_cd_steady_slope_test_tensor(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t grdpai, const cs_real_63_t grdpaj, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pia, const cs_real_6_t pja, cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition cs_convection_diffusion.h:3530
static void cs_i_cd_steady_tensor(const int ircflp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pia, const cs_real_6_t pja, cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition cs_convection_diffusion.h:2242
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:4684
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:3917
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:871
void cs_face_convection_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int iccocg, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const cs_int_t icvfli[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t 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:2940
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:1364
static void cs_i_cd_unsteady_upwind_vector(const int ircflp, 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:1791
static void cs_b_cd_unsteady_tensor(const int ircflp, const cs_real_3_t diipb, const cs_real_63_t gradi, const cs_real_6_t pi, cs_real_t pip[6])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm.
Definition cs_convection_diffusion.h:5310
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:5093
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:512
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:5029
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:1351
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:4872
void itrmas(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const iphydp, const cs_int_t *const iwgrp, const cs_int_t *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t i_massflux[], cs_real_t b_massflux[])
Definition cs_convection_diffusion.c:656
static void cs_slope_test_vector_old(const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_3_t i_face_normal, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_t i_massflux, cs_real_t testij[3], cs_real_t tesqck[3])
DEPRECATED Compute slope test criteria at internal face between cell i and j.
Definition cs_convection_diffusion.h:583
static void cs_i_cd_unsteady_slope_test_tensor(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t grdpai, const cs_real_63_t grdpaj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition cs_convection_diffusion.h:4416
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:1095
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:996
static void cs_i_cd_steady(const int ircflp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_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:1908
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:4657
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:1186
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:1259
static void cs_i_compute_quantities_vector(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t recoi[3], cs_real_t recoj[3], cs_real_t pip[3], cs_real_t pjp[3])
Reconstruct values in I' and J'.
Definition cs_convection_diffusion.h:762
static void cs_i_cd_steady_upwind_tensor(const int ircflp, 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:1665
static void cs_i_cd_unsteady_nvd(const cs_nvd_type_t limiter, 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:3955
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:1423
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:1032
void cs_convection_diffusion_thermal(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int iccocg, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a scalar field su...
Definition cs_convection_diffusion.c:6469
void cs_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int iccocg, int nswrgp, int imligp, int iphydp, int iwarnp, double epsrgp, double climgp, double extrap, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t *restrict diverg)
Update the cell mass flux divergence with the face pressure (or pressure increment,...
Definition cs_convection_diffusion.c:10935
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:4632
void cs_anisotropic_left_diffusion_vector(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int ivisep, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const cs_real_3_t coefav[], const cs_real_33_t coefbv[], const cs_real_3_t cofafv[], const cs_real_33_t cofbfv[], const cs_real_33_t i_visc[], const cs_real_t b_visc[], const cs_real_t secvif[], cs_real_3_t *restrict rhs)
Add explicit part of the terms of diffusion by a left-multiplying symmetric tensorial diffusivity for...
Definition cs_convection_diffusion.c:8334
static void cs_i_diff_flux(const int idiffp, const cs_real_t thetap, const cs_real_t pip, const cs_real_t pjp, const cs_real_t pipr, const cs_real_t pjpr, const cs_real_t i_visc, cs_real_2_t fluxij)
Add diffusive fluxes to fluxes at face ij.
Definition cs_convection_diffusion.h:1393
static void cs_i_cd_steady_slope_test_vector_old(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition cs_convection_diffusion.h:3074
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:5341
static void cs_b_upwind_flux_vector(const int iconvp, const cs_real_t thetap, const int imasac, const int inc, const int bc_type, const cs_real_3_t pi, const cs_real_3_t pir, const cs_real_3_t pipr, const cs_real_3_t coefa, const cs_real_33_t coefb, const cs_real_t b_massflux, cs_real_t flux[3])
Add convective flux (substracting the mass accumulation from it) to flux at boundary face....
Definition cs_convection_diffusion.h:4924
static void cs_b_imposed_conv_flux_vector(int iconvp, cs_real_t thetap, int imasac, int inc, cs_int_t bc_type, int icvfli, const cs_real_t pi[restrict 3], const cs_real_t pir[restrict 3], const cs_real_t pipr[restrict 3], const cs_real_t coefap[restrict 3], const cs_real_t coefbp[restrict 3][3], const cs_real_t coface[restrict 3], const cs_real_t cofbce[restrict 3][3], cs_real_t b_massflux, cs_real_t flux[restrict 3])
Add convective flux (substracting the mass accumulation from it) to flux at boundary face....
Definition cs_convection_diffusion.h:4794
static void cs_b_compute_quantities_tensor(const cs_real_3_t diipb, const cs_real_63_t gradi, const int ircflp, cs_real_t recoi[6])
Reconstruct values in I' at boundary cell i.
Definition cs_convection_diffusion.h:4606
static void cs_i_cd_unsteady_vector(const int ircflp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_t hybrid_blend_i, const cs_real_t hybrid_blend_j, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition cs_convection_diffusion.h:2556
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:446
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:8854
static void cs_blend_f_val_tensor(const double blencp, const cs_real_6_t p, cs_real_t pf[6])
Blend face values for a centered or SOLU scheme with face values for an upwind scheme.
Definition cs_convection_diffusion.h:1227
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:1155
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:4980
static void cs_i_cd_unsteady_upwind_tensor(const int ircflp, 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:1841
static void cs_i_cd_unsteady(const int ircflp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_t hybrid_blend_i, const cs_real_t hybrid_blend_j, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_t pi, const cs_real_t pj, cs_real_t *pif, cs_real_t *pjf, cs_real_t *pip, cs_real_t *pjp)
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition cs_convection_diffusion.h:2396
static void cs_i_cd_unsteady_slope_test_vector_old(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
DEPRECATED Handle preparation of internal face values for the fluxes computation in case of a unstead...
Definition cs_convection_diffusion.h:4073
void cs_convection_diffusion_vector(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int ivisep, int imasac, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const cs_int_t icvfli[], const cs_real_3_t coefav[], const cs_real_33_t coefbv[], const cs_real_3_t cofafv[], const cs_real_33_t cofbfv[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t secvif[], const cs_real_t secvib[], cs_real_3_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a vector field .
Definition cs_convection_diffusion.c:4007
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:1013
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:1123
static void cs_b_compute_quantities_vector(const cs_real_3_t diipb, const cs_real_33_t gradi, const int ircflp, cs_real_t recoi[3])
Reconstruct values in I' at boundary cell i.
Definition cs_convection_diffusion.h:4582
cs_nvd_type_t
Definition cs_convection_diffusion.h:85
@ CS_NVD_SUPERBEE
Definition cs_convection_diffusion.h:90
@ CS_NVD_SMART
Definition cs_convection_diffusion.h:88
@ CS_NVD_CUBISTA
Definition cs_convection_diffusion.h:89
@ CS_NVD_STOIC
Definition cs_convection_diffusion.h:94
@ CS_NVD_WASEB
Definition cs_convection_diffusion.h:96
@ CS_NVD_CLAM
Definition cs_convection_diffusion.h:93
@ CS_NVD_OSHER
Definition cs_convection_diffusion.h:95
@ CS_NVD_VOF_CICSAM
Definition cs_convection_diffusion.h:98
@ CS_NVD_VOF_STACS
Definition cs_convection_diffusion.h:99
@ CS_NVD_GAMMA
Definition cs_convection_diffusion.h:87
@ CS_NVD_MINMOD
Definition cs_convection_diffusion.h:92
@ CS_NVD_VOF_HRIC
Definition cs_convection_diffusion.h:97
@ CS_NVD_MUSCL
Definition cs_convection_diffusion.h:91
@ CS_NVD_N_TYPES
Definition cs_convection_diffusion.h:100
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:949
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:650
static void cs_i_cd_unsteady_slope_test(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_3_t gradsti, const cs_real_3_t gradstj, const cs_real_t pi, const cs_real_t pj, cs_real_t *pif, cs_real_t *pjf, cs_real_t *pip, cs_real_t *pjp)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition cs_convection_diffusion.h:3756
static void cs_i_cd_steady_upwind_vector(const int ircflp, 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:1582
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:5554
void cs_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int iccocg, int nswrgp, int imligp, int ircflp, int iphydp, int iwarnp, double epsrgp, double climgp, double extrap, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict diverg)
Add the explicit part of the divergence of the mass flux due to the pressure gradient (routine analog...
Definition cs_convection_diffusion.c:11311
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:1456
static void cs_i_cd_unsteady_slope_test_vector(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition cs_convection_diffusion.h:4246
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:1073
void cs_face_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int iccocg, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, double extrap, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t *restrict visel, cs_real_t *restrict i_massflux, cs_real_t *restrict b_massflux)
Update the face mass flux with the face pressure (or pressure increment, or pressure double increment...
Definition cs_convection_diffusion.c:10113
static void cs_b_cd_unsteady(const int ircflp, const cs_real_3_t diipb, const cs_real_3_t gradi, const cs_real_t pi, cs_real_t *pip)
Handle preparation of boundary face values for the flux computation in case of an unsteady algorithm.
Definition cs_convection_diffusion.h:5249
static void cs_b_imposed_conv_flux(int iconvp, cs_real_t thetap, int imasac, int inc, cs_int_t bc_type, int icvfli, cs_real_t pi, cs_real_t pir, cs_real_t pipr, cs_real_t coefap, cs_real_t coefbp, cs_real_t coface, cs_real_t cofbce, cs_real_t b_massflux, cs_real_t xcpp, cs_real_t *flux)
Add convective flux (substracting the mass accumulation from it) to flux at boundary face....
Definition cs_convection_diffusion.h:4724
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:1209
static void cs_b_cd_steady(const int ircflp, const double relaxp, const cs_real_3_t diipb, const cs_real_3_t gradi, const cs_real_t pi, const cs_real_t pia, cs_real_t *pir, cs_real_t *pipr)
Handle preparation of boundary face values for the flux computation in case of a steady algorithm.
Definition cs_convection_diffusion.h:5129
static void cs_i_compute_quantities(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_t pi, const cs_real_t pj, cs_real_t *recoi, cs_real_t *recoj, cs_real_t *pip, cs_real_t *pjp)
Reconstruct values in I' and J'.
Definition cs_convection_diffusion.h:719
static void cs_b_cd_unsteady_vector(const int ircflp, const cs_real_3_t diipb, const cs_real_33_t gradi, const cs_real_3_t pi, cs_real_t pip[3])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm.
Definition cs_convection_diffusion.h:5279
static void cs_i_compute_quantities_tensor(const int ircflp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t recoi[6], cs_real_t recoj[6], cs_real_t pip[6], cs_real_t pjp[6])
Reconstruct values in I' and J'.
Definition cs_convection_diffusion.h:817
static void cs_b_cd_steady_tensor(const int ircflp, const double relaxp, const cs_real_3_t diipb, const cs_real_63_t gradi, const cs_real_6_t pi, const cs_real_6_t pia, cs_real_t pir[6], cs_real_t pipr[6])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm.
Definition cs_convection_diffusion.h:5211
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:5364
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:1206
static void cs_i_cd_steady_slope_test_vector(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition cs_convection_diffusion.h:3302
void cs_convection_diffusion_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int iccocg, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const cs_int_t icvfli[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a standard transport equation of a scalar ...
Definition cs_convection_diffusion.c:1661
static void cs_b_compute_quantities(const cs_real_3_t diipb, const cs_real_3_t gradi, const int ircflp, cs_real_t *recoi)
Reconstruct values in I' at boundary cell i.
Definition cs_convection_diffusion.h:4560
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:980
static void cs_b_cd_steady_vector(const int ircflp, const double relaxp, const cs_real_3_t diipb, const cs_real_33_t gradi, const cs_real_3_t pi, const cs_real_3_t pia, cs_real_t pir[3], cs_real_t pipr[3])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm.
Definition cs_convection_diffusion.h:5170
void cs_max_limiter_building(int f_id, int inc, const cs_real_t rovsdt[])
Compute a coefficient for blending that ensures the positivity of the scalar.
Definition cs_convection_diffusion.c:1510
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:1303
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:933
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:311
void itrgrp(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const iphydp, const cs_int_t *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t diverg[])
Definition cs_convection_diffusion.c:788
static void cs_i_cd_unsteady_tensor(const int ircflp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition cs_convection_diffusion.h:2698
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:5058
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:9525
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:909
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:1077
#define restrict
Definition cs_defs.h:127
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
#define CS_MIN(a, b)
Definition cs_defs.h:430
int cs_int_t
Fortran-compatible integer.
Definition cs_defs.h:301
#define CS_ABS(a)
Definition cs_defs.h:429
#define CS_MAX(a, b)
Definition cs_defs.h:431
#define CS_PROCF(x, y)
Definition cs_defs.h:481
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition cs_defs.h:322
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition cs_defs.h:315
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition cs_defs.h:314
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition cs_defs.h:317
#define CS_UNUSED(x)
Definition cs_defs.h:453
#define END_C_DECLS
Definition cs_defs.h:468
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition cs_defs.h:321
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
cs_real_t cs_real_63_t[6][3]
Definition cs_defs.h:327
@ p
Definition cs_field_pointer.h:67
@ k
Definition cs_field_pointer.h:70
cs_halo_type_t
Definition cs_halo.h:50
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 (euclidien norm) between two points xa and xb in a cartesian coordinate system of ...
Definition cs_math.c:390
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:304
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:372
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:388
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:326
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition cs_math.h:193
const cs_real_t cs_math_epzero
@ CS_COUPLED_FD
Definition cs_parameters.h:145
integer(c_int), pointer, save imrgra
type of gradient reconstruction
Definition optcal.f90:286
Definition cs_mesh_quantities.h:90
Definition cs_mesh.h:63
structure containing the variable calculation options.
Definition cs_parameters.h:60