8.3
general documentation
cs_convection_diffusion.h
Go to the documentation of this file.
1#ifndef __CS_CONVECTION_DIFFUSION_H__
2#define __CS_CONVECTION_DIFFUSION_H__
3
4/*============================================================================
5 * Convection-diffusion operators.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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 "bft_mem.h"
37
38#include "cs_base.h"
39#include "cs_dispatch.h"
40#include "cs_halo.h"
41#include "cs_math.h"
42#include "cs_mesh_quantities.h"
43#include "cs_equation_param.h"
44
45/*----------------------------------------------------------------------------*/
46
48
49/*=============================================================================
50 * Macro definitions
51 *============================================================================*/
52
53/*============================================================================
54 * Type definition
55 *============================================================================*/
56
57/*----------------------------------------------------------------------------
58 * NVD/TVD Advection Scheme
59 *----------------------------------------------------------------------------*/
60
61typedef enum {
62
63 CS_NVD_GAMMA = 0, /* GAMMA */
64 CS_NVD_SMART = 1, /* SMART */
65 CS_NVD_CUBISTA = 2, /* CUBISTA */
66 CS_NVD_SUPERBEE = 3, /* SUPERBEE */
67 CS_NVD_MUSCL = 4, /* MUSCL */
68 CS_NVD_MINMOD = 5, /* MINMOD */
69 CS_NVD_CLAM = 6, /* CLAM */
70 CS_NVD_STOIC = 7, /* STOIC */
71 CS_NVD_OSHER = 8, /* OSHER */
72 CS_NVD_WASEB = 9, /* WASEB */
73 CS_NVD_VOF_HRIC = 10, /* M-HRIC for VOF */
74 CS_NVD_VOF_CICSAM = 11, /* M-CICSAM for VOF */
75 CS_NVD_VOF_STACS = 12, /* STACS for VOF */
76 CS_NVD_N_TYPES = 13 /* number of NVD schemes */
77
79
80/*============================================================================
81 * Global variables
82 *============================================================================*/
83
84/*============================================================================
85 * Public function prototypes for Fortran API
86 *============================================================================*/
87
88/*=============================================================================
89 * Public function prototypes
90 *============================================================================*/
91
92/*----------------------------------------------------------------------------
93 * Return pointer to slope test indicator field values if active.
94 *
95 * parameters:
96 * f_id <-- field id (or -1)
97 * eqp <-- equation parameters
98 *
99 * return:
100 * pointer to local values array, or NULL;
101 *----------------------------------------------------------------------------*/
102
103cs_real_t *
104cs_get_v_slope_test(int f_id,
105 const cs_equation_param_t eqp);
106
107/*----------------------------------------------------------------------------*/
116/*----------------------------------------------------------------------------*/
117
118void
120 int inc,
121 const cs_real_t rovsdt[]);
122
123/*----------------------------------------------------------------------------*/
168/*----------------------------------------------------------------------------*/
169
170void
172 int f_id,
173 const cs_equation_param_t eqp,
174 int icvflb,
175 int inc,
176 int imasac,
177 cs_real_t *pvar,
178 const cs_real_t *pvara,
179 const int icvfli[],
180 const cs_field_bc_coeffs_t *bc_coeffs,
181 const cs_real_t i_massflux[],
182 const cs_real_t b_massflux[],
183 const cs_real_t i_visc[],
184 const cs_real_t b_visc[],
185 cs_real_t *rhs);
186
187/*----------------------------------------------------------------------------*/
188/*
189 * \brief Update face flux with convection contribution of a standard transport
190 * equation of a scalar field \f$ \varia \f$.
191 *
192 * \f[
193 * C_\ij = \dot{m}_\ij \left( \varia_\fij - \varia_\celli \right)
194 * \f]
195 *
196 * \param[in] idtvar indicator of the temporal scheme
197 * \param[in] f_id field id (or -1)
198 * \param[in] eqp equation parameters
199 * \param[in] icvflb global indicator of boundary convection flux
200 * - 0 upwind scheme at all boundary faces
201 * - 1 imposed flux at some boundary faces
202 * \param[in] inc indicator
203 * - 0 when solving an increment
204 * - 1 otherwise
205 * \param[in] imasac take mass accumulation into account?
206 * \param[in] pvar solved variable (current time step)
207 * \param[in] pvara solved variable (previous time step)
208 * \param[in] icvfli boundary face indicator array of convection flux
209 * - 0 upwind scheme
210 * - 1 imposed flux
211 * \param[in] bc_coeffs boundary condition structure for the variable
212 * \param[in] i_massflux mass flux at interior faces
213 * \param[in] b_massflux mass flux at boundary faces
214 * \param[in,out] i_conv_flux scalar convection flux at interior faces
215 * \param[in,out] b_conv_flux scalar convection flux at boundary faces
216 */
217/*----------------------------------------------------------------------------*/
218
219void
221 int f_id,
222 const cs_equation_param_t eqp,
223 int icvflb,
224 int inc,
225 int imasac,
226 cs_real_t *pvar,
227 const cs_real_t *pvara,
228 const int icvfli[],
229 const cs_field_bc_coeffs_t *bc_coeffs,
230 const cs_real_t i_massflux[],
231 const cs_real_t b_massflux[],
232 cs_real_2_t i_conv_flux[],
233 cs_real_t b_conv_flux[]);
234
235/*----------------------------------------------------------------------------*/
236/*
237 * \brief Add the explicit part of the convection/diffusion terms of a transport
238 * equation of a vector field \f$ \vect{\varia} \f$.
239 *
240 * More precisely, the right hand side \f$ \vect{Rhs} \f$ is updated as
241 * follows:
242 * \f[
243 * \vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}} \left(
244 * \dot{m}_\ij \left( \vect{\varia}_\fij - \vect{\varia}_\celli \right)
245 * - \mu_\fij \gradt_\fij \vect{\varia} \cdot \vect{S}_\ij \right)
246 * \f]
247 *
248 * Remark:
249 * if ivisep = 1, then we also take \f$ \mu \transpose{\gradt\vect{\varia}}
250 * + \lambda \trace{\gradt\vect{\varia}} \f$, where \f$ \lambda \f$ is
251 * the secondary viscosity, i.e. usually \f$ -\frac{2}{3} \mu \f$.
252 *
253 * Warning:
254 * - \f$ \vect{Rhs} \f$ has already been initialized before calling bilsc!
255 * - mind the sign minus
256 *
257 * \param[in] idtvar indicator of the temporal scheme
258 * \param[in] f_id index of the current variable
259 * \param[in] eqp equation parameters
260 * \param[in] icvflb global indicator of boundary convection flux
261 * - 0 upwind scheme at all boundary faces
262 * - 1 imposed flux at some boundary faces
263 * \param[in] inc indicator
264 * - 0 when solving an increment
265 * - 1 otherwise
266 * \param[in] ivisep indicator to take \f$ \divv
267 * \left(\mu \gradt \transpose{\vect{a}} \right)
268 * -2/3 \grad\left( \mu \dive \vect{a} \right)\f$
269 * - 1 take into account,
270 * - 0 otherwise
271 * \param[in] imasac take mass accumulation into account?
272 * \param[in] pvar solved velocity (current time step)
273 * \param[in] pvara solved velocity (previous time step)
274 * \param[in] icvfli boundary face indicator array of convection flux
275 * - 0 upwind scheme
276 * - 1 imposed flux
277 * \param[in] bc_coeffs_v boundary conditions structure for the variable
278 * \param[in] i_massflux mass flux at interior faces
279 * \param[in] b_massflux mass flux at boundary faces
280 * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
281 * at interior faces for the r.h.s.
282 * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
283 * at border faces for the r.h.s.
284 * \param[in] i_secvis secondary viscosity at interior faces
285 * \param[in] b_secvis secondary viscosity at boundary faces
286 * \param[in] i_pvar velocity at interior faces
287 * \param[in] b_pvar velocity at boundary faces
288 * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
289 */
290/*----------------------------------------------------------------------------*/
291
292void
294 int f_id,
295 const cs_equation_param_t eqp,
296 int icvflb,
297 int inc,
298 int ivisep,
299 int imasac,
300 cs_real_3_t *pvar,
301 const cs_real_3_t *pvara,
302 const int icvfli[],
303 const cs_field_bc_coeffs_t *bc_coeffs_v,
304 const cs_real_t i_massflux[],
305 const cs_real_t b_massflux[],
306 const cs_real_t i_visc[],
307 const cs_real_t b_visc[],
308 const cs_real_t i_secvis[],
309 const cs_real_t b_secvis[],
310 cs_real_3_t *i_pvar,
311 cs_real_3_t *b_pvar,
312 cs_real_3_t *rhs);
313
314/*----------------------------------------------------------------------------*/
352/*----------------------------------------------------------------------------*/
353
354void
356 int f_id,
357 const cs_equation_param_t eqp,
358 int icvflb,
359 int inc,
360 int imasac,
361 cs_real_6_t *pvar,
362 const cs_real_6_t *pvara,
363 const cs_field_bc_coeffs_t *bc_coeffs_ts,
364 const cs_real_t i_massflux[],
365 const cs_real_t b_massflux[],
366 const cs_real_t i_visc[],
367 const cs_real_t b_visc[],
368 cs_real_6_t *rhs);
369
370/*----------------------------------------------------------------------------*/
405/*----------------------------------------------------------------------------*/
406
407void
409 int f_id,
410 const cs_equation_param_t eqp,
411 int inc,
412 int imasac,
413 cs_real_t * pvar,
414 const cs_real_t * pvara,
415 const cs_field_bc_coeffs_t *bc_coeffs,
416 const cs_real_t i_massflux[],
417 const cs_real_t b_massflux[],
418 const cs_real_t i_visc[],
419 const cs_real_t b_visc[],
420 const cs_real_t xcpp[],
421 cs_real_t * rhs);
422
423/*----------------------------------------------------------------------------*/
424/*
425 * \brief Add the explicit part of the diffusion terms with a symmetric tensor
426 * diffusivity for a transport equation of a scalar field \f$ \varia \f$.
427 *
428 * More precisely, the right hand side \f$ Rhs \f$ is updated as
429 * follows:
430 * \f[
431 * Rhs = Rhs - \sum_{\fij \in \Facei{\celli}} \left(
432 * - \tens{\mu}_\fij \gradv_\fij \varia \cdot \vect{S}_\ij \right)
433 * \f]
434 *
435 * Warning:
436 * - \f$ Rhs \f$ has already been initialized before
437 * calling cs_anisotropic_diffusion_scalar!
438 * - mind the sign minus
439 *
440 * \param[in] idtvar indicator of the temporal scheme
441 * \param[in] f_id index of the current variable
442 * \param[in] eqp equation parameters
443 * \param[in] inc indicator
444 * - 0 when solving an increment
445 * - 1 otherwise
446 * \param[in] pvar solved variable (current time step)
447 * \param[in] pvara solved variable (previous time step)
448 * \param[in] bc_coeffs boundary condition structure for the variable
449 * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
450 * at interior faces for the r.h.s.
451 * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
452 * at border faces for the r.h.s.
453 * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
454 * \param[in] weighf internal face weight between cells i j in case
455 * of tensor diffusion
456 * \param[in] weighb boundary face weight for cells i in case
457 * of tensor diffusion
458 * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
459 */
460/*----------------------------------------------------------------------------*/
461
462void
464 int f_id,
465 const cs_equation_param_t eqp,
466 int inc,
467 cs_real_t * pvar,
468 const cs_real_t * pvara,
469 const cs_field_bc_coeffs_t *bc_coeffs,
470 const cs_real_t i_visc[],
471 const cs_real_t b_visc[],
472 cs_real_6_t * viscel,
473 const cs_real_2_t weighf[],
474 const cs_real_t weighb[],
475 cs_real_t * rhs);
476
477/*-----------------------------------------------------------------------------*/
478/*
479 * \brief Add explicit part of the terms of diffusion by a left-multiplying
480 * symmetric tensorial diffusivity for a transport equation of a vector field
481 * \f$ \vect{\varia} \f$.
482 *
483 * More precisely, the right hand side \f$ \vect{Rhs} \f$ is updated as
484 * follows:
485 * \f[
486 * \vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}} \left(
487 * - \gradt_\fij \vect{\varia} \tens{\mu}_\fij \cdot \vect{S}_\ij \right)
488 * \f]
489 *
490 * Remark:
491 * if ivisep = 1, then we also take \f$ \mu \transpose{\gradt\vect{\varia}}
492 * + \lambda \trace{\gradt\vect{\varia}} \f$, where \f$ \lambda \f$ is
493 * the secondary viscosity, i.e. usually \f$ -\frac{2}{3} \mu \f$.
494 *
495 * Warning:
496 * - \f$ \vect{Rhs} \f$ has already been initialized before calling the present
497 * function
498 * - mind the sign minus
499 *
500 * \param[in] idtvar indicator of the temporal scheme
501 * \param[in] f_id index of the current variable
502 * \param[in] eqp equation parameters
503 * \param[in] inc indicator
504 * - 0 when solving an increment
505 * - 1 otherwise
506 * \param[in] ivisep indicator to take \f$ \divv
507 * \left(\mu \gradt \transpose{\vect{a}} \right)
508 * -2/3 \grad\left( \mu \dive \vect{a} \right)\f$
509 * - 1 take into account,
510 * \param[in] pvar solved variable (current time step)
511 * \param[in] pvara solved variable (previous time step)
512 * \param[in] bc_coeffs_v boundary conditions structure for the variable
513 * \param[in] i_visc \f$ \tens{\mu}_\fij \dfrac{S_\fij}{\ipf\jpf} \f$
514 * at interior faces for the r.h.s.
515 * \param[in] b_visc \f$ \dfrac{S_\fib}{\ipf \centf} \f$
516 * at border faces for the r.h.s.
517 * \param[in] i_secvis secondary viscosity at interior faces
518 * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
519 */
520/*----------------------------------------------------------------------------*/
521
522void
524 int f_id,
525 const cs_equation_param_t eqp,
526 int inc,
527 int ivisep,
528 cs_real_3_t *pvar,
529 const cs_real_3_t *pvara,
530 const cs_field_bc_coeffs_t *bc_coeffs_v,
531 const cs_real_33_t i_visc[],
532 const cs_real_t b_visc[],
533 const cs_real_t i_secvis[],
534 cs_real_3_t *rhs);
535
536/*-----------------------------------------------------------------------------*/
537/*
538 * \brief Add explicit part of the terms of diffusion by a right-multiplying
539 * symmetric tensorial diffusivity for a transport equation of a vector field
540 * \f$ \vect{\varia} \f$.
541 *
542 * More precisely, the right hand side \f$ \vect{Rhs} \f$ is updated as
543 * follows:
544 * \f[
545 * \vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}} \left(
546 * - \gradt_\fij \vect{\varia} \tens{\mu}_\fij \cdot \vect{S}_\ij \right)
547 * \f]
548 *
549 * Warning:
550 * - \f$ \vect{Rhs} \f$ has already been initialized before calling the present
551 * function
552 * - mind the sign minus
553 *
554 * \param[in] idtvar indicator of the temporal scheme
555 * \param[in] f_id index of the current variable
556 * \param[in] eqp equation parameters
557 * \param[in] inc indicator
558 * - 0 when solving an increment
559 * - 1 otherwise
560 * \param[in] pvar solved variable (current time step)
561 * \param[in] pvara solved variable (previous time step)
562 * \param[in] bc_coeffs_v boundary condition structure for the variable
563 * \param[in] i_visc \f$ \tens{\mu}_\fij \dfrac{S_\fij}{\ipf\jpf} \f$
564 * at interior faces for the r.h.s.
565 * \param[in] b_visc \f$ \dfrac{S_\fib}{\ipf \centf} \f$
566 * at border faces for the r.h.s.
567 * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
568 * \param[in] weighf internal face weight between cells i j in case
569 * of tensor diffusion
570 * \param[in] weighb boundary face weight for cells i in case
571 * of tensor diffusion
572 * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
573 */
574/*----------------------------------------------------------------------------*/
575
576void
578 int f_id,
579 const cs_equation_param_t eqp,
580 int inc,
581 cs_real_3_t *pvar,
582 const cs_real_3_t *pvara,
583 const cs_field_bc_coeffs_t *bc_coeffs_v,
584 const cs_real_t i_visc[],
585 const cs_real_t b_visc[],
586 cs_real_6_t *viscel,
587 const cs_real_2_t weighf[],
588 const cs_real_t weighb[],
589 cs_real_3_t *rhs);
590
591/*----------------------------------------------------------------------------*/
592/*
593 * \brief Add the explicit part of the diffusion terms with a symmetric tensor
594 * diffusivity for a transport equation of a scalar field \f$ \varia \f$.
595 *
596 * More precisely, the right hand side \f$ Rhs \f$ is updated as
597 * follows:
598 * \f[
599 * Rhs = Rhs - \sum_{\fij \in \Facei{\celli}} \left(
600 * - \tens{\mu}_\fij \gradv_\fij \varia \cdot \vect{S}_\ij \right)
601 * \f]
602 *
603 * Warning:
604 * - \f$ Rhs \f$ has already been initialized before
605 * calling cs_anisotropic_diffusion_scalar!
606 * - mind the sign minus
607 *
608 * \param[in] idtvar indicator of the temporal scheme
609 * \param[in] f_id index of the current variable
610 * \param[in] eqp equation parameters
611 * \param[in] inc indicator
612 * - 0 when solving an increment
613 * - 1 otherwise
614 * \param[in] pvar solved variable (current time step)
615 * \param[in] pvara solved variable (previous time step)
616 * \param[in] bc_coeffs_ts boundary condition structure for the variable
617 * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
618 * at interior faces for the r.h.s.
619 * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
620 * at border faces for the r.h.s.
621 * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
622 * \param[in] weighf internal face weight between cells i j in case
623 * of tensor diffusion
624 * \param[in] weighb boundary face weight for cells i in case
625 * of tensor diffusion
626 * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
627 */
628/*----------------------------------------------------------------------------*/
629
630void
632 int f_id,
633 const cs_equation_param_t eqp,
634 int inc,
635 cs_real_6_t *pvar,
636 const cs_real_6_t *pvara,
637 const cs_field_bc_coeffs_t *bc_coeffs_ts,
638 const cs_real_t i_visc[],
639 const cs_real_t b_visc[],
640 cs_real_6_t *viscel,
641 const cs_real_2_t weighf[],
642 const cs_real_t weighb[],
643 cs_real_6_t *rhs);
644
645/*----------------------------------------------------------------------------*/
646/*
647 * \brief Update the face mass flux with the face pressure (or pressure
648 * increment, or pressure double increment) gradient.
649 *
650 * \f[
651 * \dot{m}_\ij = \dot{m}_\ij
652 * - \Delta t \grad_\fij \delta p \cdot \vect{S}_\ij
653 * \f]
654 *
655 * Please refer to the
656 * <a href="../../theory.pdf#cs_face_diffusion_potential">
657 <b>cs_face_diffusion_potential/cs_diffusion_potential</b></a>
658 * section of the theory guide for more information.
659 *
660 * \param[in] f_id field id (or -1)
661 * \param[in] m pointer to mesh
662 * \param[in] fvq pointer to finite volume quantities
663 * \param[in] init indicator
664 * - 1 initialize the mass flux to 0
665 * - 0 otherwise
666 * \param[in] inc indicator
667 * - 0 when solving an increment
668 * - 1 otherwise
669 * \param[in] imrgra indicator
670 * - 0 iterative gradient
671 * - 1 least squares gradient
672 * \param[in] nswrgp number of reconstruction sweeps for the
673 * gradients
674 * \param[in] imligp clipping gradient method
675 * - < 0 no clipping
676 * - = 0 thank to neighbooring gradients
677 * - = 1 thank to the mean gradient
678 * \param[in] iphydp hydrostatic pressure indicator
679 * \param[in] iwgrp indicator
680 * - 1 weight gradient by vicosity*porosity
681 * - weighting determined by field options
682 * \param[in] iwarnp verbosity
683 * \param[in] epsrgp relative precision for the gradient
684 * reconstruction
685 * \param[in] climgp clipping coeffecient for the computation of
686 * the gradient
687 * \param[in] frcxt body force creating the hydrostatic pressure
688 * \param[in] pvar solved variable (current time step)
689 * \param[in] bc_coeffs boundary condition structure for the variable
690 * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
691 * at interior faces for the r.h.s.
692 * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
693 * at border faces for the r.h.s.
694 * \param[in] visel viscosity by cell
695 * \param[in,out] i_massflux mass flux at interior faces
696 * \param[in,out] b_massflux mass flux at boundary faces
697 */
698/*----------------------------------------------------------------------------*/
699
700void
702 const cs_mesh_t *m,
704 int init,
705 int inc,
706 int imrgra,
707 int nswrgp,
708 int imligp,
709 int iphydp,
710 int iwgrp,
711 int iwarnp,
712 double epsrgp,
713 double climgp,
714 cs_real_3_t *frcxt,
715 cs_real_t *pvar,
716 const cs_field_bc_coeffs_t *bc_coeffs,
717 const cs_real_t i_visc[],
718 const cs_real_t b_visc[],
719 cs_real_t *visel,
720 cs_real_t *i_massflux,
721 cs_real_t *b_massflux);
722
723/*----------------------------------------------------------------------------*/
724/*
725 * \brief Add the explicit part of the pressure gradient term to the mass flux
726 * in case of anisotropic diffusion of the pressure field \f$ P \f$.
727 *
728 * More precisely, the mass flux side \f$ \dot{m}_\fij \f$ is updated as
729 * follows:
730 * \f[
731 * \dot{m}_\fij = \dot{m}_\fij -
732 * \left( \tens{\mu}_\fij \gradv_\fij P \cdot \vect{S}_\ij \right)
733 * \f]
734 *
735 * \param[in] f_id field id (or -1)
736 * \param[in] m pointer to mesh
737 * \param[in] fvq pointer to finite volume quantities
738 * \param[in] init indicator
739 * - 1 initialize the mass flux to 0
740 * - 0 otherwise
741 * \param[in] inc indicator
742 * - 0 when solving an increment
743 * - 1 otherwise
744 * \param[in] imrgra indicator
745 * - 0 iterative gradient
746 * - 1 least squares gradient
747 * \param[in] nswrgp number of reconstruction sweeps for the
748 * gradients
749 * \param[in] imligp clipping gradient method
750 * - < 0 no clipping
751 * - = 0 thank to neighbooring gradients
752 * - = 1 thank to the mean gradient
753 * \param[in] ircflp indicator
754 * - 1 flux reconstruction,
755 * - 0 otherwise
756 * \param[in] ircflb indicator
757 * - 1 boundary flux reconstruction,
758 * - 0 otherwise
759 * \param[in] iphydp indicator
760 * - 1 hydrostatic pressure taken into account
761 * - 0 otherwise
762 * \param[in] iwgrp indicator
763 * - 1 weight gradient by vicosity*porosity
764 * - weighting determined by field options
765 * \param[in] iwarnp verbosity
766 * \param[in] epsrgp relative precision for the gradient
767 * reconstruction
768 * \param[in] climgp clipping coeffecient for the computation of
769 * the gradient
770 * \param[in] frcxt body force creating the hydrostatic pressure
771 * \param[in] pvar solved variable (pressure)
772 * \param[in] bc_coeffs boundary condition structure for the variable
773 * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
774 * at interior faces for the r.h.s.
775 * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
776 * at border faces for the r.h.s.
777 * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
778 * \param[in] weighf internal face weight between cells i j in case
779 * of tensor diffusion
780 * \param[in] weighb boundary face weight for cells i in case
781 * of tensor diffusion
782 * \param[in,out] i_massflux mass flux at interior faces
783 * \param[in,out] b_massflux mass flux at boundary faces
784 */
785/*----------------------------------------------------------------------------*/
786
787void
789 const cs_mesh_t *m,
791 int init,
792 int inc,
793 int imrgra,
794 int nswrgp,
795 int imligp,
796 int ircflp,
797 int ircflb,
798 int iphydp,
799 int iwgrp,
800 int iwarnp,
801 double epsrgp,
802 double climgp,
803 cs_real_3_t *frcxt,
804 cs_real_t *pvar,
805 const cs_field_bc_coeffs_t *bc_coeffs,
806 const cs_real_t i_visc[],
807 const cs_real_t b_visc[],
808 cs_real_6_t *viscel,
809 const cs_real_2_t weighf[],
810 const cs_real_t weighb[],
811 cs_real_t *i_massflux,
812 cs_real_t *b_massflux);
813
814/*----------------------------------------------------------------------------*/
861/*----------------------------------------------------------------------------*/
862
863void
865 const cs_mesh_t *m,
867 int init,
868 int inc,
869 int imrgra,
870 int nswrgp,
871 int imligp,
872 int iphydp,
873 int iwgrp,
874 int iwarnp,
875 double epsrgp,
876 double climgp,
877 cs_real_3_t *frcxt,
878 cs_real_t *pvar,
879 const cs_field_bc_coeffs_t *bc_coeffs,
880 const cs_real_t i_visc[],
881 const cs_real_t b_visc[],
882 cs_real_t visel[],
883 cs_real_t *diverg);
884
885/*----------------------------------------------------------------------------*/
886/*
887 * \brief Add the explicit part of the divergence of the mass flux due to the
888 * pressure gradient (analog to cs_anisotropic_diffusion_scalar).
889 *
890 * More precisely, the divergence of the mass flux side
891 * \f$ \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij \f$ is updated as follows:
892 * \f[
893 * \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij
894 * = \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij
895 * - \sum_{\fij \in \Facei{\celli}}
896 * \left( \tens{\mu}_\fij \gradv_\fij P \cdot \vect{S}_\ij \right)
897 * \f]
898 *
899 * \param[in] f_id field id (or -1)
900 * \param[in] m pointer to mesh
901 * \param[in] fvq pointer to finite volume quantities
902 * \param[in] init indicator
903 * - 1 initialize the mass flux to 0
904 * - 0 otherwise
905 * \param[in] inc indicator
906 * - 0 when solving an increment
907 * - 1 otherwise
908 * \param[in] imrgra indicator
909 * - 0 iterative gradient
910 * - 1 least squares gradient
911 * \param[in] nswrgp number of reconstruction sweeps for the
912 * gradients
913 * \param[in] imligp clipping gradient method
914 * - < 0 no clipping
915 * - = 0 thank to neighbooring gradients
916 * - = 1 thank to the mean gradient
917 * \param[in] ircflp indicator
918 * - 1 flux reconstruction,
919 * - 0 otherwise
920 * \param[in] ircflb indicator
921 * - 1 boundary flux reconstruction,
922 * - 0 otherwise
923 * \param[in] iphydp indicator
924 * - 1 hydrostatic pressure taken into account
925 * - 0 otherwise
926 * \param[in] iwgrp indicator
927 * - 1 weight gradient by vicosity*porosity
928 * - weighting determined by field options
929 * \param[in] iwarnp verbosity
930 * \param[in] epsrgp relative precision for the gradient
931 * reconstruction
932 * \param[in] climgp clipping coeffecient for the computation of
933 * the gradient
934 * \param[in] frcxt body force creating the hydrostatic pressure
935 * \param[in] pvar solved variable (pressure)
936 * \param[in] bc_coeffs boundary condition structure for the variable
937 * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
938 * at interior faces for the r.h.s.
939 * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
940 * at border faces for the r.h.s.
941 * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
942 * \param[in] weighf internal face weight between cells i j in case
943 * of tensor diffusion
944 * \param[in] weighb boundary face weight for cells i in case
945 * of tensor diffusion
946 * \param[in,out] diverg divergence of the mass flux
947 */
948/*----------------------------------------------------------------------------*/
949
950void
952 const cs_mesh_t *m,
954 int init,
955 int inc,
956 int imrgra,
957 int nswrgp,
958 int imligp,
959 int ircflp,
960 int ircflb,
961 int iphydp,
962 int iwgrp,
963 int iwarnp,
964 double epsrgp,
965 double climgp,
966 cs_real_3_t *frcxt,
967 cs_real_t *pvar,
968 const cs_field_bc_coeffs_t *bc_coeffs,
969 const cs_real_t i_visc[],
970 const cs_real_t b_visc[],
971 cs_real_6_t *viscel,
972 const cs_real_2_t weighf[],
973 const cs_real_t weighb[],
974 cs_real_t *diverg);
975
976/*----------------------------------------------------------------------------*/
977
979
980#ifdef __cplusplus
981
982/*----------------------------------------------------------------------------*/
999/*----------------------------------------------------------------------------*/
1000
1001void
1002cs_slope_test_gradient(int f_id,
1003 cs_dispatch_context &ctx,
1004 int inc,
1005 cs_halo_type_t halo_type,
1006 const cs_real_3_t *grad,
1007 cs_real_3_t *grdpa,
1008 const cs_real_t *pvar,
1009 const cs_field_bc_coeffs_t *bc_coeffs,
1010 const cs_real_t *i_massflux);
1011
1012/*----------------------------------------------------------------------------*/
1013/*
1014 * \brief Compute the upwind gradient used in the pure SOLU schemes
1015 * (observed in the litterature).
1016 *
1017 * \param[in] f_id field index
1018 * \param[in] ctx Reference to dispatch context
1019 * \param[in] inc Not an increment flag
1020 * \param[in] halo_type halo type
1021 * \param[in] bc_coeffs boundary condition structure for the variable
1022 * \param[in] i_massflux mass flux at interior faces
1023 * \param[in] b_massflux mass flux at boundary faces
1024 * \param[in] pvar values
1025 * \param[out] grdpa upwind gradient
1026 */
1027/*----------------------------------------------------------------------------*/
1028
1029void
1030cs_upwind_gradient(const int f_id,
1031 cs_dispatch_context &ctx,
1032 const int inc,
1033 const cs_halo_type_t halo_type,
1034 const cs_field_bc_coeffs_t *bc_coeffs,
1035 const cs_real_t i_massflux[],
1036 const cs_real_t b_massflux[],
1037 const cs_real_t *pvar,
1038 cs_real_3_t *grdpa);
1039
1040/*----------------------------------------------------------------------------
1041 * Compute the local cell Courant number as the maximum of all cell face based
1042 * Courant number at each cell.
1043 *
1044 * parameters:
1045 * f <-- pointer to field
1046 * ctx <-- reference to dispatch context
1047 * courant --> cell Courant number
1048 */
1049/*----------------------------------------------------------------------------*/
1050
1051void
1053 cs_dispatch_context &ctx,
1054 cs_real_t *courant);
1055
1056#endif /* cplusplus */
1057
1058#endif /* __CS_CONVECTION_DIFFUSION_H__ */
void cs_upwind_gradient(const int f_id, cs_dispatch_context &ctx, const int inc, const cs_halo_type_t halo_type, const cs_field_bc_coeffs_t *bc_coeffs, 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 used in the pure SOLU schemes (observed in the litterature).
Definition: cs_convection_diffusion.cpp:12685
void cs_slope_test_gradient(int f_id, cs_dispatch_context &ctx, 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_field_bc_coeffs_t *bc_coeffs, const cs_real_t *i_massflux)
Compute the upwind gradient used in the slope tests.
Definition: cs_convection_diffusion.cpp:12597
void cs_cell_courant_number(const cs_field_t *f, cs_dispatch_context &ctx, cs_real_t *courant)
Definition: cs_convection_diffusion.cpp:12518
void cs_convection_diffusion_tensor(int idtvar, int f_id, const cs_equation_param_t eqp, int icvflb, int inc, int imasac, cs_real_6_t *pvar, const cs_real_6_t *pvara, const cs_field_bc_coeffs_t *bc_coeffs_ts, 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 *rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a tensor field .
void cs_convection_diffusion_vector(int idtvar, int f_id, const cs_equation_param_t eqp, int icvflb, int inc, int ivisep, int imasac, cs_real_3_t *pvar, const cs_real_3_t *pvara, const int icvfli[], const cs_field_bc_coeffs_t *bc_coeffs_v, const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t i_secvis[], const cs_real_t b_secvis[], cs_real_3_t *i_pvar, cs_real_3_t *b_pvar, cs_real_3_t *rhs)
void cs_anisotropic_diffusion_scalar(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_t *pvar, const cs_real_t *pvara, const cs_field_bc_coeffs_t *bc_coeffs, 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 *rhs)
void cs_anisotropic_left_diffusion_vector(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, int ivisep, cs_real_3_t *pvar, const cs_real_3_t *pvara, const cs_field_bc_coeffs_t *bc_coeffs_v, const cs_real_33_t i_visc[], const cs_real_t b_visc[], const cs_real_t i_secvis[], cs_real_3_t *rhs)
cs_real_t * cs_get_v_slope_test(int f_id, const cs_equation_param_t eqp)
Definition: cs_convection_diffusion.cpp:7381
void cs_anisotropic_diffusion_tensor(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_6_t *pvar, const cs_real_6_t *pvara, const cs_field_bc_coeffs_t *bc_coeffs_ts, 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_6_t *rhs)
void cs_convection_diffusion_thermal(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, int imasac, cs_real_t *pvar, const cs_real_t *pvara, const cs_field_bc_coeffs_t *bc_coeffs, 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 *rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a scalar field su...
void cs_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int ircflp, int ircflb, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *frcxt, cs_real_t *pvar, const cs_field_bc_coeffs_t *bc_coeffs, 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)
void cs_convection_diffusion_scalar(int idtvar, int f_id, const cs_equation_param_t eqp, int icvflb, int inc, int imasac, cs_real_t *pvar, const cs_real_t *pvara, const int icvfli[], const cs_field_bc_coeffs_t *bc_coeffs, 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 *rhs)
Add the explicit part of the convection/diffusion terms of a standard transport equation of a scalar ...
cs_nvd_type_t
Definition: cs_convection_diffusion.h:61
@ CS_NVD_SUPERBEE
Definition: cs_convection_diffusion.h:66
@ CS_NVD_SMART
Definition: cs_convection_diffusion.h:64
@ CS_NVD_CUBISTA
Definition: cs_convection_diffusion.h:65
@ CS_NVD_STOIC
Definition: cs_convection_diffusion.h:70
@ CS_NVD_WASEB
Definition: cs_convection_diffusion.h:72
@ CS_NVD_CLAM
Definition: cs_convection_diffusion.h:69
@ CS_NVD_OSHER
Definition: cs_convection_diffusion.h:71
@ CS_NVD_VOF_CICSAM
Definition: cs_convection_diffusion.h:74
@ CS_NVD_VOF_STACS
Definition: cs_convection_diffusion.h:75
@ CS_NVD_GAMMA
Definition: cs_convection_diffusion.h:63
@ CS_NVD_MINMOD
Definition: cs_convection_diffusion.h:68
@ CS_NVD_VOF_HRIC
Definition: cs_convection_diffusion.h:73
@ CS_NVD_MUSCL
Definition: cs_convection_diffusion.h:67
@ CS_NVD_N_TYPES
Definition: cs_convection_diffusion.h:76
void cs_face_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int ircflp, int ircflb, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *frcxt, cs_real_t *pvar, const cs_field_bc_coeffs_t *bc_coeffs, 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)
void cs_face_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *frcxt, cs_real_t *pvar, const cs_field_bc_coeffs_t *bc_coeffs, 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)
void cs_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *frcxt, cs_real_t *pvar, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t *diverg)
Update the cell mass flux divergence with the face pressure (or pressure increment,...
void cs_anisotropic_right_diffusion_vector(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_3_t *pvar, const cs_real_3_t *pvara, const cs_field_bc_coeffs_t *bc_coeffs_v, 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_3_t *rhs)
void cs_face_convection_scalar(int idtvar, int f_id, const cs_equation_param_t eqp, int icvflb, int inc, int imasac, cs_real_t *pvar, const cs_real_t *pvara, const int icvfli[], const cs_field_bc_coeffs_t *bc_coeffs, 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[])
void cs_beta_limiter_building(int f_id, int inc, const cs_real_t rovsdt[])
Compute the beta blending coefficient of the beta limiter (ensuring preservation of a given min/max p...
Definition: cs_convection_diffusion.cpp:7430
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:359
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:358
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:361
#define END_C_DECLS
Definition: cs_defs.h:543
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:368
cs_halo_type_t
Definition: cs_halo.h:56
integer(c_int), pointer, save imrgra
type of gradient reconstruction
Definition: optcal.f90:92
integer(c_int), pointer, save idtvar
option for a variable time step
Definition: optcal.f90:193
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:192
Field boundary condition descriptor (for variables)
Definition: cs_field.h:104
Field descriptor.
Definition: cs_field.h:131
Definition: cs_mesh_quantities.h:92
Definition: cs_mesh.h:85