8.1
general documentation
cs_boundary_conditions_set_coeffs.h
Go to the documentation of this file.
1 #ifndef __CS_BOUNDARY_CONDITIONS_SET_COEFFS_H__
2 #define __CS_BOUNDARY_CONDITIONS_SET_COEFFS_H__
3 
4 /*============================================================================
5  * Boundary condition management.
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 #include "bft_error.h"
37 #include "cs_math.h"
38 
39 /*----------------------------------------------------------------------------*/
40 
42 
43 /*=============================================================================
44  * Public function prototypes
45  *============================================================================*/
46 
47 /*----------------------------------------------------------------------------*/
53 /*----------------------------------------------------------------------------*/
54 
55 /*----------------------------------------------------------------------------*/
56 /*
57  * \brief Translation of the boundary conditions given by the user
58  * in a form that fits to the solver.
59  *
60  * The values at a boundary face \f$ \fib \f$ stored in the face center
61  * \f$ \centf \f$ of the variable \f$ P \f$ and its diffusive flux \f$ Q \f$
62  * are written as:
63  * \f[
64  * P_{\face} = A_P^g + B_P^g P_{\centi}
65  * \f]
66  * and
67  * \f[
68  * Q_{\face} = A_P^f + B_P^f P_{\centi}
69  * \f]
70  * where \f$ P_\centi \f$ is the value of the variable \f$ P \f$ at the
71  * neighboring cell.
72  *
73  * \warning
74  * - If we consider an increment of a variable, the boundary conditions
75  * read:
76  * \f[
77  * \delta P_{\face} = B_P^g \delta P_{\centi}
78  * \f]
79  * and
80  * \f[
81  * \delta Q_{\face} = -B_P^f \delta P_{\centi}
82  * \f]
83  *
84  * - For a vector field such as the velocity \f$ \vect{u} \f$ the boundary
85  * conditions may read:
86  * \f[
87  * \vect{u}_{\face} = \vect{A}_u^g + \tens{B}_u^g \vect{u}_{\centi}
88  * \f]
89  * and
90  * \f[
91  * \vect{Q}_{\face} = \vect{A}_u^f + \tens{B}_u^f \vect{u}_{\centi}
92  * \f]
93  * where \f$ \tens{B}_u^g \f$ and \f$ \tens{B}_u^f \f$ are 3x3 tensor matrix
94  * which coupled velocity components next to a boundary.
95  *
96  * Please refer to the
97  * <a href="../../theory.pdf#boundary"><b>boundary conditions</b></a> section
98  * of the theory guide for more informations, as well as the
99  * <a href="../../theory.pdf#condli"><b>condli</b></a> section.
100  *
101  * \param[in] nvar total number of variables
102  * \param[in] iterns iteration number on Navier-Stokes equations
103  * \param[in] isvhb indicator to save exchange coeffient
104  * at the walls
105  * \param[in] itrale ALE iteration number
106  * \param[in] italim for ALE
107  * \param[in] itrfin for ALE
108  * \param[in] ineefl for ALE
109  * \param[in] itrfup for ALE
110  * \param[in,out] isostd indicator for standard outlet
111  * and reference face index
112  * \param[in] dt time step (per cell)
113  * \param[out] visvdr dynamic viscosity after V. Driest damping in
114  * boundary cells
115  * \param[out] hbord exchange coefficient at boundary
116  * \param[out] theipb value of thermal scalar at \f$ \centip \f$
117  * of boundary cells
118  * \param[in] nftcdt Global indicator of condensation source terms
119  * (ie. sum on the processors of nfbpcd) cells
120  * associated to the face with condensation
121  * phenomenon
122  */
123 /*----------------------------------------------------------------------------*/
124 
125 void
127  int iterns,
128  int isvhb,
129  int itrale,
130  int italim,
131  int itrfin,
132  int ineefl,
133  int itrfup,
134  int isostd[],
135  cs_real_t visvdr[],
136  cs_real_t hbord[],
137  cs_real_t theipb[],
138  int nftcdt);
139 
140 /*----------------------------------------------------------------------------*/
144 /*----------------------------------------------------------------------------*/
145 
146 void
148 
149 /*----------------------------------------------------------------------------*/
160 /*----------------------------------------------------------------------------*/
161 
162 inline static void
164  cs_real_t *af,
165  cs_real_t *b,
166  cs_real_t *bf,
167  cs_real_t qimp,
168  cs_real_t hint)
169 {
170  /* Gradient BCs */
171  *a = -qimp/cs_math_fmax(hint, 1.e-300);
172  *b = 1.;
173 
174  /* Flux BCs */
175  *af = qimp;
176  *bf = 0.;
177 }
178 
179 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 inline static void
192  cs_real_t *af,
193  cs_real_t *b,
194  cs_real_t *bf)
195 {
196  /* Gradient BCs */
197  *a = 0.;
198  *b = 1.;
199 
200  /* Flux BCs */
201  *af = 0.;
202  *bf = 0.;
203 }
204 
205 /*----------------------------------------------------------------------------*/
216 /*----------------------------------------------------------------------------*/
217 
218 inline static void
220  cs_real_t af[3],
221  cs_real_t b[3][3],
222  cs_real_t bf[3][3],
223  const cs_real_t qimpv[3],
224  cs_real_t hint)
225 {
226  /* Gradient BCs */
227 
228  for (size_t i = 0; i < 3; i++) {
229  a[i] = -qimpv[i] / fmax(hint, 1.e-300);
230  }
231 
232  b[0][0] = 1., b[0][1] = 0., b[0][2] = 0.;
233  b[1][0] = 0., b[1][1] = 1., b[1][2] = 0.;
234  b[2][0] = 0., b[2][1] = 0., b[2][2] = 1.;
235 
236  /* Flux BCs */
237 
238  for (size_t i = 0; i < 3; i++) {
239  af[i] = qimpv[i];
240 
241  for (size_t j = 0; j < 3; j++)
242  bf[i][j] = 0.;
243  }
244 }
245 
246 /*----------------------------------------------------------------------------*/
257 /*----------------------------------------------------------------------------*/
258 
259 inline static void
261  cs_real_t af[3],
262  cs_real_t b[3][3],
263  cs_real_t bf[3][3],
264  const cs_real_t qimpv[3],
265  const cs_real_t hint[6])
266 {
267  cs_real_t m[6] = {0., 0., 0., 0., 0., 0.};
268  m[0] = hint[1]*hint[2] - hint[4]*hint[4];
269  m[1] = hint[0]*hint[2] - hint[5]*hint[5];
270  m[2] = hint[0]*hint[1] - hint[3]*hint[3];
271  m[3] = hint[4]*hint[5] - hint[3]*hint[2];
272  m[4] = hint[3]*hint[5] - hint[0]*hint[4];
273  m[5] = hint[3]*hint[4] - hint[1]*hint[5];
274 
275  cs_real_t invdet = 1./(hint[0]*m[0] + hint[3]*m[3] + hint[5]*m[5]);
276 
277  cs_real_t invh[6] = {0., 0., 0., 0., 0., 0.};
278  invh[0] = m[0] * invdet;
279  invh[1] = m[1] * invdet;
280  invh[2] = m[2] * invdet;
281  invh[3] = m[3] * invdet;
282  invh[4] = m[4] * invdet;
283  invh[5] = m[5] * invdet;
284 
285  /* Gradient BCs */
286  cs_math_sym_33_3_product(invh, qimpv, a);
287  for (int isou = 0; isou < 3; isou++)
288  a[isou] = -a[isou];
289 
290  b[0][0] = 1.0, b[0][1] = 0.0, b[0][2] = 0.0;
291  b[1][0] = 0.0, b[1][1] = 1.0, b[1][2] = 0.0;
292  b[2][0] = 0.0, b[2][1] = 0.0, b[2][2] = 1.0;
293 
294  for (int isou = 0; isou < 3; isou++) {
295 
296  /* Flux BCs */
297  af[isou] = qimpv[isou];
298  for (int jsou = 0; jsou < 3; jsou++)
299  bf[isou][jsou] = 0.0;
300  }
301 }
302 
303 /*----------------------------------------------------------------------------*/
313 /*----------------------------------------------------------------------------*/
314 
315 inline static void
317  cs_real_t af[6],
318  cs_real_t b[6][6],
319  cs_real_t bf[6][6],
320  const cs_real_t qimpts[6],
321  cs_real_t hint)
322 {
323  for (int isou = 0; isou < 6; isou++) {
324 
325  /* Gradient BC */
326  a[isou] = -qimpts[isou]/cs_math_fmax(hint, 1.e-300);
327  for (int jsou = 0; jsou < 6; jsou++) {
328  if (jsou == isou)
329  b[isou][jsou] = 1.0;
330  else
331  b[isou][jsou] = 0.0;
332  }
333 
334  /* Flux BCs */
335  af[isou] = qimpts[isou];
336  for (int jsou = 0; jsou < 6; jsou++)
337  bf[isou][jsou] = 0.0;
338  }
339 }
340 
341 /*----------------------------------------------------------------------------*/
354 /*----------------------------------------------------------------------------*/
355 
356 inline static void
358  cs_real_t *af,
359  cs_real_t *b,
360  cs_real_t *bf,
361  cs_real_t pimp,
362  cs_real_t hint,
363  cs_real_t hext)
364 {
365  //if (fabs(hext) > cs_math_infinite_r*0.5) {
366  if (hext < 0.) {
367 
368  /* Gradient BCs */
369  *a = pimp;
370  *b = 0.;
371 
372  /* Flux BCs */
373  *af = -hint*pimp;
374  *bf = hint;
375 
376  }
377  else {
378 
379  /* Gradient BCs */
380  *a = hext*pimp/(hint + hext);
381  *b = hint /(hint + hext);
382 
383  /* Flux BCs */
384  cs_real_t heq = hint*hext/(hint + hext);
385  *af = -heq*pimp;
386  *bf = heq;
387 
388  }
389 }
390 
391 /*----------------------------------------------------------------------------*/
404 /*----------------------------------------------------------------------------*/
405 
406 inline static void
408  cs_real_t af[3],
409  cs_real_t b[3][3],
410  cs_real_t bf[3][3],
411  const cs_real_t pimpv[3],
412  cs_real_t hint,
413  const cs_real_t hextv[3])
414 {
415  for (int isou = 0; isou < 3; isou++) {
416  if (fabs(hextv[isou]) > 0.5*cs_math_infinite_r) {
417 
418  /* Gradient BCs */
419  a[isou] = pimpv[isou];
420  for (int jsou = 0; jsou < 3; jsou++)
421  b[isou][jsou] = 0.;
422 
423  /* Flux BCs */
424  af[isou] = -hint*pimpv[isou];
425 
426  bf[0][0] = hint, bf[0][1] = 0., bf[0][2] = 0.;
427  bf[1][0] = 0., bf[1][1] = hint, bf[1][2] = 0.;
428  bf[2][0] = 0., bf[2][1] = 0., bf[2][2] = hint;
429 
430  }
431  else {
432 
433  const cs_real_t val = hint/(hint + hextv[isou]);
434  const cs_real_t heq = hextv[isou]*val;
435 
436  /* Gradient BCs */
437  a[isou] = hextv[isou]*pimpv[isou]/(hint + hextv[isou]);
438 
439  b[0][0] = val, b[0][1] = 0., b[0][2] = 0.;
440  b[1][0] = 0., b[1][1] = val, b[1][2] = 0.;
441  b[2][0] = 0., b[2][1] = 0., b[2][2] = val;
442 
443  /* Flux BCs */
444  af[isou] = -heq*pimpv[isou];
445 
446  bf[0][0] = heq, bf[0][1] = 0., bf[0][2] = 0.;
447  bf[1][0] = 0., bf[1][1] = heq, bf[1][2] = 0.;
448  bf[2][0] = 0., bf[2][1] = 0., bf[2][2] = heq;
449 
450  }
451  }
452 }
453 
454 /*----------------------------------------------------------------------------*/
455 /*
456  * \brief Set convective oulet BC for a scalar for a given face.
457  *
458  * \param[out] a explicit BC coefficient for gradients
459  * \param[out] af explicit BC coefficient for diffusive flux
460  * \param[out] b implicit BC coefficient for gradients
461  * \param[out] bf implicit BC coefficient for diffusive flux
462  * \param[in] pimp flux value to impose
463  * \param[in] cfl local Courant number used to convect
464  * \param[in] hint internal exchange coefficient
465  */
466 /*----------------------------------------------------------------------------*/
467 
468 void
470  cs_real_t *af,
471  cs_real_t *b,
472  cs_real_t *bf,
473  cs_real_t pimp,
474  cs_real_t cfl,
475  cs_real_t hint);
476 
477 /*----------------------------------------------------------------------------*/
491 /*----------------------------------------------------------------------------*/
492 
493 inline static void
495  cs_real_t af[3],
496  cs_real_t b[3][3],
497  cs_real_t bf[3][3],
498  const cs_real_t pimpv[3],
499  const cs_real_t hintt[6],
500  const cs_real_t hextv[3])
501 {
502  /* Gradient BCs */
503  for (int isou = 0; isou < 3; isou++) {
504  if (fabs(hextv[isou]) > 0.5*cs_math_infinite_r) {
505  a[isou] = pimpv[isou];
506  for (int jsou = 0; jsou < 3; jsou++)
507  b[isou][jsou] = 0.;
508  }
509  else {
510  /* FIXME: at least log error message */
511  bft_error(__FILE__, __LINE__, 0,
512  _(" %s: hextv not set for component %d."),
513  __func__, isou);
514  }
515  }
516 
517  /* Flux BCs */
518  cs_math_sym_33_3_product(hintt, pimpv, af);
519  for (int isou = 0; isou < 3; isou++)
520  af[isou] = -af[isou];
521 
522  bf[0][0] = hintt[0];
523  bf[1][1] = hintt[1];
524  bf[2][2] = hintt[2];
525  bf[0][1] = hintt[3];
526  bf[1][0] = hintt[3];
527  bf[1][2] = hintt[4];
528  bf[2][1] = hintt[4];
529  bf[0][2] = hintt[5];
530  bf[2][0] = hintt[5];
531 }
532 
533 /*----------------------------------------------------------------------------*/
545 /*----------------------------------------------------------------------------*/
546 
547 inline static void
549  cs_real_t af[6],
550  cs_real_t b[6][6],
551  cs_real_t bf[6][6],
552  const cs_real_t pimpts[6],
553  cs_real_t hint,
554  const cs_real_t hextts[6])
555 {
556  for (int isou = 0; isou < 6; isou++) {
557 
558  if (fabs(hextts[isou]) > 0.5*cs_math_infinite_r) {
559  /* Gradient BCs */
560  a[isou] = pimpts[isou];
561  for (int jsou = 0; jsou < 6; jsou++)
562  b[isou][jsou] = 0.;
563 
564  /* Flux BCs */
565  af[isou] = -hint * pimpts[isou];
566  for (int jsou = 0; jsou < 6; jsou++) {
567  if (jsou == isou)
568  bf[isou][jsou] = hint;
569  else
570  bf[isou][jsou] = 0.;
571  }
572  }
573  else {
574 
575  const cs_real_t heq = hint * hextts[isou] / (hint + hextts[isou]);
576 
577  /* Gradient BCs */
578  a[isou] = hextts[isou] * pimpts[isou] / (hint + hextts[isou]);
579  for (int jsou = 0; jsou < 6; jsou++) {
580  if (jsou == isou)
581  b[isou][jsou] = hint / (hint + hextts[isou]);
582  else
583  b[isou][jsou] = 0.;
584  }
585 
586  /* Flux BCs */
587  af[isou] = -heq * pimpts[isou];
588  for (int jsou = 0; jsou < 6; jsou++) {
589  if (jsou == isou)
590  bf[isou][jsou] = heq;
591  else
592  bf[isou][jsou] = 0.;
593  }
594  }
595  }
596 }
597 
598 /*----------------------------------------------------------------------------*/
611 /*----------------------------------------------------------------------------*/
612 
613 inline static void
615  cs_real_t af[3],
616  cs_real_t b[3][3],
617  cs_real_t bf[3][3],
618  const cs_real_t pimpv[3],
619  const cs_real_t qimpv[3],
620  cs_real_t hint,
621  const cs_real_t normal[3])
622 {
623  for (int isou = 0; isou < 3; isou++) {
624 
625  /* Gradient BCs */
626  a[isou] = - qimpv[isou]/cs_math_fmax(hint, 1.e-300);
627  /* "[1 -n(x)n] Qimp / hint" is divided into two */
628  for (int jsou = 0; jsou < 3; jsou++) {
629 
630  a[isou] = a[isou] + normal[isou]*normal[jsou]
631  * (pimpv[jsou] + qimpv[jsou] / cs_math_fmax(hint, 1.e-300));
632 
633  if (jsou == isou)
634  b[isou][jsou] = 1.0 - normal[isou] * normal[jsou];
635  else
636  b[isou][jsou] = - normal[isou] * normal[jsou];
637  }
638 
639  /* Flux BCs */
640  af[isou] = qimpv[isou];
641  /* "[1 -n(x)n] Qimp" is divided into two */
642  for (int jsou = 0; jsou < 3; jsou++){
643 
644  af[isou] = af[isou] - normal[isou]*normal[jsou]
645  * (hint * pimpv[jsou] + qimpv[jsou]);
646 
647  bf[isou][jsou] = hint * normal[isou] * normal[jsou];
648  }
649  }
650 }
651 
652 /*----------------------------------------------------------------------------*/
666 /*----------------------------------------------------------------------------*/
667 
668 void
670  (cs_real_t a[3],
671  cs_real_t af[3],
672  cs_real_t b[3][3],
673  cs_real_t bf[3][3],
674  const cs_real_t pimpv[3],
675  const cs_real_t qimpv[3],
676  const cs_real_t hint[6],
677  const cs_real_t normal[3]);
678 
679 /*----------------------------------------------------------------------------*/
692 /*----------------------------------------------------------------------------*/
693 
694 inline static void
696  (cs_real_t a[3],
697  cs_real_t af[3],
698  cs_real_t b[3][3],
699  cs_real_t bf[3][3],
700  const cs_real_t pimpv[3],
701  const cs_real_t qimpv[3],
702  cs_real_t hint,
703  const cs_real_t normal[3])
704 {
705  for (int isou = 0; isou < 3; isou++) {
706 
707  /* Gradient BC*/
708  /* "[1 -n(x)n] Pimp" is divided into two */
709  a[isou] = pimpv[isou];
710  for (int jsou = 0; jsou < 3; jsou++) {
711 
712  a[isou] = a[isou] - normal[isou]*normal[jsou]
713  * (pimpv[jsou] + qimpv[jsou] / cs_math_fmax(hint, 1.e-300));
714 
715  b[isou][jsou] = normal[isou] * normal[jsou];
716  }
717 
718  /* Flux BC */
719  /* "[1 -n(x)n] Pimp" is divided into two */
720  af[isou] = -hint*pimpv[isou];
721  for (int jsou = 0; jsou < 3; jsou++) {
722 
723  af[isou] = af[isou] + normal[isou]*normal[jsou]
724  * (qimpv[jsou] + pimpv[jsou] * hint);
725 
726  if (jsou == isou)
727  bf[isou][jsou] = hint * (1.0 - normal[isou] * normal[jsou]);
728  else
729  bf[isou][jsou] = - hint * normal[isou] * normal[jsou];
730  }
731  }
732 }
733 
734 /*----------------------------------------------------------------------------*/
748 /*----------------------------------------------------------------------------*/
749 
750 void
752  (cs_real_t a[3],
753  cs_real_t af[3],
754  cs_real_t b[3][3],
755  cs_real_t bf[3][3],
756  const cs_real_t pimpv[3],
757  const cs_real_t qimpv[3],
758  const cs_real_t hint[6],
759  const cs_real_t normal[3]);
760 
761 /*----------------------------------------------------------------------------*/
773 /*----------------------------------------------------------------------------*/
774 
775 inline static void
777  cs_real_t af[3],
778  cs_real_t b[3][3],
779  cs_real_t bf[3][3],
780  const cs_real_t pimpv[3],
781  const cs_real_t cflv[3],
782  cs_real_t hint)
783 {
784  for (int isou = 0; isou < 3; isou++) {
785 
786  /* Gradient BCs */
787  for (int jsou = 0; jsou < 3; jsou ++) {
788  if (jsou == isou)
789  b[isou][jsou] = cflv[isou] / (1.0 + cflv[isou]);
790  else
791  b[isou][jsou] = 0.0;
792  }
793  a[isou] = pimpv[isou] * (1.0 - b[isou][isou]);
794 
795  /* Flux BCs */
796  af[isou] = -hint * a[isou];
797  for (int jsou = 0; jsou < 3; jsou++) {
798  if (jsou == isou)
799  bf[isou][jsou] = hint * (1.0 - b[isou][jsou]);
800  else
801  bf[isou][jsou] = 0.0;
802  }
803  }
804 }
805 
806 /*----------------------------------------------------------------------------*/
818 /*----------------------------------------------------------------------------*/
819 
820 inline static void
822  cs_real_t af[6],
823  cs_real_t b[6][6],
824  cs_real_t bf[6][6],
825  const cs_real_t pimpts[6],
826  const cs_real_t cflts[6],
827  cs_real_t hint)
828 {
829  for (int isou = 0; isou < 6; isou++) {
830 
831  /* Gradient BCs */
832  for (int jsou = 0; jsou < 6; jsou++) {
833  if (jsou == isou)
834  b[isou][jsou] = cflts[isou] / (1.0 + cflts[isou]);
835  else
836  b[isou][jsou] = 0.0;
837  }
838  a[isou] = (1.0 - b[isou][isou]) * pimpts[isou];
839 
840  /* Flux BCs */
841  af[isou] = -hint*a[isou];
842  for (int jsou = 0; jsou < 6; jsou++) {
843  if (jsou == isou)
844  bf[isou][jsou] = hint * (1.0 - b[isou][jsou]);
845  else
846  bf[isou][jsou] = 0.0;
847  }
848  }
849 }
850 
851 /*----------------------------------------------------------------------------*/
863 /*----------------------------------------------------------------------------*/
864 
865 inline static void
867  (cs_real_t a[3],
868  cs_real_t af[3],
869  cs_real_t b[3][3],
870  cs_real_t bf[3][3],
871  const cs_real_t pimpv[3],
872  const cs_real_t cflv[3],
873  const cs_real_t hintt[6])
874 {
875  for(int isou = 0; isou < 3; isou++) {
876 
877  /* Gradient BCs */
878  for (int jsou = 0; jsou < 3; jsou++) {
879  if (jsou == isou)
880  b[isou][jsou] = cflv[isou]/(1.0+cflv[isou]);
881  else
882  b[isou][jsou] = 0.0;
883  }
884  a[isou] = (1.0-b[isou][isou])*pimpv[isou];
885 
886  }
887 
888  /* Flux BCs */
889  cs_math_sym_33_3_product(hintt, a, af);
890  for (int isou = 0; isou < 3; isou++)
891  af[isou] = -af[isou];
892 
893  bf[0][0] = hintt[0]*(1.0 - b[0][0]);
894  bf[1][1] = hintt[1]*(1.0 - b[1][1]);
895  bf[2][2] = hintt[2]*(1.0 - b[2][2]);
896  bf[0][1] = hintt[3]*(1.0 - b[0][0]);
897  bf[1][0] = hintt[3]*(1.0 - b[0][0]);
898  bf[1][2] = hintt[4]*(1.0 - b[1][1]);
899  bf[2][1] = hintt[4]*(1.0 - b[1][1]);
900  bf[0][2] = hintt[5]*(1.0 - b[2][2]);
901  bf[2][0] = hintt[5]*(1.0 - b[2][2]);
902 }
903 
904 /*----------------------------------------------------------------------------*/
916 /*----------------------------------------------------------------------------*/
917 
918 inline static void
920  cs_real_t *af,
921  cs_real_t *b,
922  cs_real_t *bf,
923  cs_real_t pinf,
924  cs_real_t ratio,
925  cs_real_t hint)
926 {
927  /* Gradient BCs */
928  *b = ratio;
929  *a = pinf;
930 
931  /* Flux BCs */
932  *af = -hint * *a;
933  *bf = hint * (1. - *b);
934 }
935 
936 /*----------------------------------------------------------------------------*/
947 /*----------------------------------------------------------------------------*/
948 
949 inline static void
951  cs_real_t *af,
952  cs_real_t *b,
953  cs_real_t *bf,
954  cs_real_t dimp,
955  cs_real_t hint)
956 
957 {
958  /* Gradient BCs */
960  &*af,
961  &*b,
962  &*bf,
963  dimp,
964  hint);
965 
966  /* Flux BCs */
967  *af = 0.;
968  *bf = 0.;
969 }
970 
971 /*----------------------------------------------------------------------------*/
984 /*----------------------------------------------------------------------------*/
985 
986 inline static void
988  (cs_real_t *a,
989  cs_real_t *af,
990  cs_real_t *b,
991  cs_real_t *bf,
992  cs_real_t pinf,
993  cs_real_t ratio,
994  cs_real_t dimp)
995 {
996  /* Gradient BCs */
997  *b = ratio;
998  *a = pinf;
999 
1000  /* Flux BCs */
1001  *af = dimp;
1002  *bf = 0.;
1003 }
1004 
1005 /*----------------------------------------------------------------------------*/
1016 /*----------------------------------------------------------------------------*/
1017 
1018 inline static void
1020  cs_real_t *af,
1021  cs_real_t *b,
1022  cs_real_t *bf,
1023  cs_real_t hext,
1024  cs_real_t dimp)
1025 {
1026  /* Gradients BCs */
1027  *a = 0.;
1028  *b = 1.;
1029 
1030  /* Flux BCs */
1031  *af = dimp;
1032  *bf = hext;
1033 }
1034 
1035 
1036 /*----------------------------------------------------------------------------*/
1048 /*----------------------------------------------------------------------------*/
1049 
1050 inline static void
1052  cs_real_t *af,
1053  cs_real_t *b,
1054  cs_real_t *bf,
1055  cs_real_t pimp,
1056  cs_real_t dimp)
1057 {
1058  /* Gradients BC */
1059  *a = pimp;
1060  *b = 0.;
1061 
1062  /* Flux BCs */
1063  *af = dimp;
1064  *bf = 0.;
1065 }
1066 
1067 /*----------------------------------------------------------------------------*/
1079 /*----------------------------------------------------------------------------*/
1080 
1081 inline static void
1083  (cs_real_t a[3],
1084  cs_real_t af[3],
1085  cs_real_t b[3][3],
1086  cs_real_t bf[3][3],
1087  const cs_real_t pimpv[3],
1088  const cs_real_t qimpv[3])
1089 {
1090  for (int isou = 0; isou < 3; isou++) {
1091 
1092  /* Gradient BCs */
1093  a[isou] = pimpv[isou];
1094  for (int jsou = 0; jsou < 3; jsou++)
1095  b[isou][jsou] = 0.0;
1096 
1097 
1098  /* Flux BCs */
1099  af[isou] = qimpv[isou];
1100  for (int jsou = 0; jsou < 3; jsou++)
1101  bf[isou][jsou] = 0.0;
1102  }
1103 }
1104 
1105 /*----------------------------------------------------------------------------*/
1117 /*----------------------------------------------------------------------------*/
1118 
1119 inline static void
1121  (cs_real_t a[6],
1122  cs_real_t af[6],
1123  cs_real_t b[6][6],
1124  cs_real_t bf[6][6],
1125  const cs_real_t pimpts[6],
1126  const cs_real_t qimpts[6])
1127 {
1128  for (int isou = 0; isou < 6; isou++) {
1129 
1130  /* BS test sur hextv ? if (abs(hextv[isou])>rinfin*0.5d0) then */
1131 
1132  /* Gradient BCs */
1133  a[isou] = pimpts[isou];
1134  for (int jsou = 0; jsou < 6; jsou++)
1135  b[isou][jsou] = 0.0;
1136 
1137  /* Flux BCs */
1138  af[isou] = qimpts[isou];
1139  for (int jsou = 0; jsou < 6; jsou++)
1140  bf[isou][jsou] = 0.0;
1141  }
1142 }
1143 
1144 /*----------------------------------------------------------------------------*/
1145 
1147 
1148 #endif /* __CS_BOUNDARY_CONDITIONS_SET_COEFFS_H__ */
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193
static void cs_boundary_conditions_set_neumann_scalar(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t qimp, cs_real_t hint)
Set Neumann BC for a scalar for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:163
static void cs_boundary_conditions_set_dirichlet_scalar(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t pimp, cs_real_t hint, cs_real_t hext)
Set Dirichlet BC for a scalar for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:357
static void cs_boundary_conditions_set_dirichlet_vector_aniso(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t hintt[6], const cs_real_t hextv[3])
Set Dirichlet BC for a vector for a given face with left anisotropic diffusion.
Definition: cs_boundary_conditions_set_coeffs.h:494
static void cs_boundary_conditions_set_dirichlet_conv_neumann_diff_vector(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t qimpv[3])
Imposed value for the convection operator, imposed flux for diffusion, for a vector.
Definition: cs_boundary_conditions_set_coeffs.h:1083
static void cs_boundary_conditions_set_neumann_vector_aniso(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t qimpv[3], const cs_real_t hint[6])
Set neumann BC for an anisotropic vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:260
static void cs_boundary_conditions_set_convective_outlet_tensor(cs_real_t a[6], cs_real_t af[6], cs_real_t b[6][6], cs_real_t bf[6][6], const cs_real_t pimpts[6], const cs_real_t cflts[6], cs_real_t hint)
Set convective outlet BC for a tensor for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:821
static void cs_boundary_conditions_set_dirichlet_vector(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], cs_real_t hint, const cs_real_t hextv[3])
Set Dirichlet BC for a vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:407
static void cs_boundary_conditions_set_neumann_conv_h_neumann_diff_scalar(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t dimp, cs_real_t hint)
Set Neumann BC for the convection operator, zero flux for diffusion.
Definition: cs_boundary_conditions_set_coeffs.h:950
static void cs_boundary_conditions_set_dirichlet_conv_neumann_diff_scalar(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t pimp, cs_real_t dimp)
Imposed value for the convection operator, imposed flux for diffusion, for a scalar.
Definition: cs_boundary_conditions_set_coeffs.h:1051
void cs_boundary_conditions_set_coeffs_init(void)
Initialization of boundary condition arrays.
Definition: cs_boundary_conditions_set_coeffs.c:3653
static void cs_boundary_conditions_set_affine_function_conv_neumann_diff_scalar(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t pinf, cs_real_t ratio, cs_real_t dimp)
Set Neumann BC for the convection operator, imposed flux for diffusion.
Definition: cs_boundary_conditions_set_coeffs.h:988
static void cs_boundary_conditions_set_affine_function_scalar(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t pinf, cs_real_t ratio, cs_real_t hint)
Set BC for an affine scalar function for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:919
static void cs_boundary_conditions_set_generalized_sym_vector(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t qimpv[3], cs_real_t hint, const cs_real_t normal[3])
Set generalized BC for a symmetric vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:614
static void cs_boundary_conditions_set_dirichlet_conv_neumann_diff_tensor(cs_real_t a[6], cs_real_t af[6], cs_real_t b[6][6], cs_real_t bf[6][6], const cs_real_t pimpts[6], const cs_real_t qimpts[6])
Imposed value for the convection operator, imposed flux for diffusion, for a tensor.
Definition: cs_boundary_conditions_set_coeffs.h:1121
static void cs_boundary_conditions_set_convective_outlet_vector(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t cflv[3], cs_real_t hint)
Set convective outlet BC for a vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:776
void cs_boundary_conditions_set_coeffs(int nvar, int iterns, int isvhb, int itrale, int italim, int itrfin, int ineefl, int itrfup, int isostd[], cs_real_t visvdr[], cs_real_t hbord[], cs_real_t theipb[], int nftcdt)
Translation of the boundary conditions given by the user in a form that fits to the solver.
Definition: cs_boundary_conditions_set_coeffs.c:535
static void cs_boundary_conditions_set_convective_outlet_vector_aniso(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t cflv[3], const cs_real_t hintt[6])
Set convective outlet BC for an anisotropic vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:867
static void cs_boundary_conditions_set_generalized_dirichlet_vector(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t qimpv[3], cs_real_t hint, const cs_real_t normal[3])
Set generalized Dirichlet BC for a vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:696
void cs_boundary_conditions_set_generalized_sym_vector_aniso(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t qimpv[3], const cs_real_t hint[6], const cs_real_t normal[3])
Set generalized BC for an anisotropic symmetric vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.c:3836
static void cs_boundary_conditions_set_total_flux(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t hext, cs_real_t dimp)
Set total flux as a Robin condition.
Definition: cs_boundary_conditions_set_coeffs.h:1019
static void cs_boundary_conditions_set_neumann_scalar_hmg(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf)
Set homogeneous Neumann BC for a scalar for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:191
static void cs_boundary_conditions_set_neumann_vector(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t qimpv[3], cs_real_t hint)
Set Neumann BC for a scalar for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:219
static void cs_boundary_conditions_set_dirichlet_tensor(cs_real_t a[6], cs_real_t af[6], cs_real_t b[6][6], cs_real_t bf[6][6], const cs_real_t pimpts[6], cs_real_t hint, const cs_real_t hextts[6])
Set Dirichlet BC for a tensor for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:548
void cs_boundary_conditions_set_convective_outlet_scalar(cs_real_t *a, cs_real_t *af, cs_real_t *b, cs_real_t *bf, cs_real_t pimp, cs_real_t cfl, cs_real_t hint)
Set convective oulet boundary condition for a scalar.
Definition: cs_boundary_conditions_set_coeffs.c:3801
void cs_boundary_conditions_set_generalized_dirichlet_vector_aniso(cs_real_t a[3], cs_real_t af[3], cs_real_t b[3][3], cs_real_t bf[3][3], const cs_real_t pimpv[3], const cs_real_t qimpv[3], const cs_real_t hint[6], const cs_real_t normal[3])
Set generalized Dirichlet BC for an anisotropic vector for a given face.
Definition: cs_boundary_conditions_set_coeffs.c:3918
static void cs_boundary_conditions_set_neumann_tensor(cs_real_t a[6], cs_real_t af[6], cs_real_t b[6][6], cs_real_t bf[6][6], const cs_real_t qimpts[6], cs_real_t hint)
Set Neumann boundary conditions for a tensor for a given face.
Definition: cs_boundary_conditions_set_coeffs.h:316
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define _(String)
Definition: cs_defs.h:63
#define END_C_DECLS
Definition: cs_defs.h:515
static cs_real_t cs_math_fmax(cs_real_t x, cs_real_t y)
Compute the max value of two real values.
Definition: cs_math.h:180
static void cs_math_sym_33_3_product(const cs_real_t m[6], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values....
Definition: cs_math.h:655
const cs_real_t cs_math_infinite_r
integer, save nftcdt
Global indicator of condensation source terms (ie. sum on the processors of nfbpcd) cells associated ...
Definition: optcal.f90:812
integer, save nvar
number of solved variables (must be lower than nvarmx)
Definition: dimens.f90:42
double precision, save fmax
Definition: coincl.f90:184
real(c_double), dimension(:), pointer, save qimp
Definition: coincl.f90:158