1 #ifndef __CS_BOUNDARY_CONDITIONS_SET_COEFFS_H__
2 #define __CS_BOUNDARY_CONDITIONS_SET_COEFFS_H__
228 for (
size_t i = 0; i < 3; i++) {
229 a[i] = -qimpv[i] /
fmax(hint, 1.e-300);
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.;
238 for (
size_t i = 0; i < 3; i++) {
241 for (
size_t j = 0; j < 3; j++)
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];
275 cs_real_t invdet = 1./(hint[0]*m[0] + hint[3]*m[3] + hint[5]*m[5]);
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;
287 for (
int isou = 0; isou < 3; isou++)
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;
294 for (
int isou = 0; isou < 3; isou++) {
297 af[isou] = qimpv[isou];
298 for (
int jsou = 0; jsou < 3; jsou++)
299 bf[isou][jsou] = 0.0;
323 for (
int isou = 0; isou < 6; isou++) {
327 for (
int jsou = 0; jsou < 6; jsou++) {
335 af[isou] = qimpts[isou];
336 for (
int jsou = 0; jsou < 6; jsou++)
337 bf[isou][jsou] = 0.0;
380 *a = hext*pimp/(hint + hext);
381 *b = hint /(hint + hext);
415 for (
int isou = 0; isou < 3; isou++) {
419 a[isou] = pimpv[isou];
420 for (
int jsou = 0; jsou < 3; jsou++)
424 af[isou] = -hint*pimpv[isou];
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;
433 const cs_real_t val = hint/(hint + hextv[isou]);
437 a[isou] = hextv[isou]*pimpv[isou]/(hint + hextv[isou]);
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;
444 af[isou] = -heq*pimpv[isou];
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;
503 for (
int isou = 0; isou < 3; isou++) {
505 a[isou] = pimpv[isou];
506 for (
int jsou = 0; jsou < 3; jsou++)
512 _(
" %s: hextv not set for component %d."),
519 for (
int isou = 0; isou < 3; isou++)
520 af[isou] = -af[isou];
556 for (
int isou = 0; isou < 6; isou++) {
560 a[isou] = pimpts[isou];
561 for (
int jsou = 0; jsou < 6; jsou++)
565 af[isou] = -hint * pimpts[isou];
566 for (
int jsou = 0; jsou < 6; jsou++) {
568 bf[isou][jsou] = hint;
575 const cs_real_t heq = hint * hextts[isou] / (hint + hextts[isou]);
578 a[isou] = hextts[isou] * pimpts[isou] / (hint + hextts[isou]);
579 for (
int jsou = 0; jsou < 6; jsou++) {
581 b[isou][jsou] = hint / (hint + hextts[isou]);
587 af[isou] = -heq * pimpts[isou];
588 for (
int jsou = 0; jsou < 6; jsou++) {
590 bf[isou][jsou] = heq;
623 for (
int isou = 0; isou < 3; isou++) {
628 for (
int jsou = 0; jsou < 3; jsou++) {
630 a[isou] = a[isou] + normal[isou]*normal[jsou]
631 * (pimpv[jsou] + qimpv[jsou] /
cs_math_fmax(hint, 1.e-300));
634 b[isou][jsou] = 1.0 - normal[isou] * normal[jsou];
636 b[isou][jsou] = - normal[isou] * normal[jsou];
640 af[isou] = qimpv[isou];
642 for (
int jsou = 0; jsou < 3; jsou++){
644 af[isou] = af[isou] - normal[isou]*normal[jsou]
645 * (hint * pimpv[jsou] + qimpv[jsou]);
647 bf[isou][jsou] = hint * normal[isou] * normal[jsou];
705 for (
int isou = 0; isou < 3; isou++) {
709 a[isou] = pimpv[isou];
710 for (
int jsou = 0; jsou < 3; jsou++) {
712 a[isou] = a[isou] - normal[isou]*normal[jsou]
713 * (pimpv[jsou] + qimpv[jsou] /
cs_math_fmax(hint, 1.e-300));
715 b[isou][jsou] = normal[isou] * normal[jsou];
720 af[isou] = -hint*pimpv[isou];
721 for (
int jsou = 0; jsou < 3; jsou++) {
723 af[isou] = af[isou] + normal[isou]*normal[jsou]
724 * (qimpv[jsou] + pimpv[jsou] * hint);
727 bf[isou][jsou] = hint * (1.0 - normal[isou] * normal[jsou]);
729 bf[isou][jsou] = - hint * normal[isou] * normal[jsou];
784 for (
int isou = 0; isou < 3; isou++) {
787 for (
int jsou = 0; jsou < 3; jsou ++) {
789 b[isou][jsou] = cflv[isou] / (1.0 + cflv[isou]);
793 a[isou] = pimpv[isou] * (1.0 - b[isou][isou]);
796 af[isou] = -hint * a[isou];
797 for (
int jsou = 0; jsou < 3; jsou++) {
799 bf[isou][jsou] = hint * (1.0 - b[isou][jsou]);
801 bf[isou][jsou] = 0.0;
829 for (
int isou = 0; isou < 6; isou++) {
832 for (
int jsou = 0; jsou < 6; jsou++) {
834 b[isou][jsou] = cflts[isou] / (1.0 + cflts[isou]);
838 a[isou] = (1.0 - b[isou][isou]) * pimpts[isou];
841 af[isou] = -hint*a[isou];
842 for (
int jsou = 0; jsou < 6; jsou++) {
844 bf[isou][jsou] = hint * (1.0 - b[isou][jsou]);
846 bf[isou][jsou] = 0.0;
875 for(
int isou = 0; isou < 3; isou++) {
878 for (
int jsou = 0; jsou < 3; jsou++) {
880 b[isou][jsou] = cflv[isou]/(1.0+cflv[isou]);
884 a[isou] = (1.0-b[isou][isou])*pimpv[isou];
890 for (
int isou = 0; isou < 3; isou++)
891 af[isou] = -af[isou];
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]);
933 *bf = hint * (1. - *b);
1090 for (
int isou = 0; isou < 3; isou++) {
1093 a[isou] = pimpv[isou];
1094 for (
int jsou = 0; jsou < 3; jsou++)
1095 b[isou][jsou] = 0.0;
1099 af[isou] = qimpv[isou];
1100 for (
int jsou = 0; jsou < 3; jsou++)
1101 bf[isou][jsou] = 0.0;
1128 for (
int isou = 0; isou < 6; isou++) {
1133 a[isou] = pimpts[isou];
1134 for (
int jsou = 0; jsou < 6; jsou++)
1135 b[isou][jsou] = 0.0;
1138 af[isou] = qimpts[isou];
1139 for (
int jsou = 0; jsou < 6; jsou++)
1140 bf[isou][jsou] = 0.0;
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