8.2
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 
47 #ifdef __cplusplus
48 
49 /*----------------------------------------------------------------------------*/
66 /*----------------------------------------------------------------------------*/
67 
68 void
69 cs_slope_test_gradient(int f_id,
70  cs_dispatch_context &ctx,
71  int inc,
72  cs_halo_type_t halo_type,
73  const cs_real_3_t *grad,
74  cs_real_3_t *grdpa,
75  const cs_real_t *pvar,
76  const cs_field_bc_coeffs_t *bc_coeffs,
77  const cs_real_t *i_massflux);
78 
79 /*----------------------------------------------------------------------------*/
80 /*
81  * \brief Compute the upwind gradient used in the pure SOLU schemes
82  * (observed in the litterature).
83  *
84  * \param[in] f_id field index
85  * \param[in] ctx Reference to dispatch context
86  * \param[in] inc Not an increment flag
87  * \param[in] halo_type halo type
88  * \param[in] bc_coeffs boundary condition structure for the variable
89  * \param[in] i_massflux mass flux at interior faces
90  * \param[in] b_massflux mass flux at boundary faces
91  * \param[in] pvar values
92  * \param[out] grdpa upwind gradient
93  */
94 /*----------------------------------------------------------------------------*/
95 
96 void
97 cs_upwind_gradient(const int f_id,
98  cs_dispatch_context &ctx,
99  const int inc,
100  const cs_halo_type_t halo_type,
101  const cs_field_bc_coeffs_t *bc_coeffs,
102  const cs_real_t i_massflux[],
103  const cs_real_t b_massflux[],
104  const cs_real_t *restrict pvar,
105  cs_real_3_t *restrict grdpa);
106 
107 #endif
108 
110 
111 /*=============================================================================
112  * Macro definitions
113  *============================================================================*/
114 
115 /*============================================================================
116  * Type definition
117  *============================================================================*/
118 
119 /*----------------------------------------------------------------------------
120  * NVD/TVD Advection Scheme
121  *----------------------------------------------------------------------------*/
122 
123 typedef enum {
124 
125  CS_NVD_GAMMA = 0, /* GAMMA */
126  CS_NVD_SMART = 1, /* SMART */
127  CS_NVD_CUBISTA = 2, /* CUBISTA */
128  CS_NVD_SUPERBEE = 3, /* SUPERBEE */
129  CS_NVD_MUSCL = 4, /* MUSCL */
130  CS_NVD_MINMOD = 5, /* MINMOD */
131  CS_NVD_CLAM = 6, /* CLAM */
132  CS_NVD_STOIC = 7, /* STOIC */
133  CS_NVD_OSHER = 8, /* OSHER */
134  CS_NVD_WASEB = 9, /* WASEB */
135  CS_NVD_VOF_HRIC = 10, /* M-HRIC for VOF */
136  CS_NVD_VOF_CICSAM = 11, /* M-CICSAM for VOF */
137  CS_NVD_VOF_STACS = 12, /* STACS for VOF */
138  CS_NVD_N_TYPES = 13 /* number of NVD schemes */
139 
141 
142 /*============================================================================
143  * Global variables
144  *============================================================================*/
145 
146 /*============================================================================
147  * Public function prototypes for Fortran API
148  *============================================================================*/
149 
150 /*=============================================================================
151  * Public function prototypes
152  *============================================================================*/
153 
154 /*----------------------------------------------------------------------------
155  * Compute the local cell Courant number as the maximum of all cell face based
156  * Courant number at each cell.
157  *
158  * parameters:
159  * f_id <-- field id (or -1)
160  * courant --> cell Courant number
161  */
162 /*----------------------------------------------------------------------------*/
163 
164 void
165 cs_cell_courant_number(const int f_id,
166  cs_real_t *courant);
167 
168 /*----------------------------------------------------------------------------
169  * Return pointer to slope test indicator field values if active.
170  *
171  * parameters:
172  * f_id <-- field id (or -1)
173  * eqp <-- equation parameters
174  *
175  * return:
176  * pointer to local values array, or NULL;
177  *----------------------------------------------------------------------------*/
178 
179 cs_real_t *
180 cs_get_v_slope_test(int f_id,
181  const cs_equation_param_t eqp);
182 
183 /*----------------------------------------------------------------------------*/
192 /*----------------------------------------------------------------------------*/
193 
194 void
195 cs_beta_limiter_building(int f_id,
196  int inc,
197  const cs_real_t rovsdt[]);
198 
199 /*----------------------------------------------------------------------------*/
244 /*----------------------------------------------------------------------------*/
245 
246 void
248  int f_id,
249  const cs_equation_param_t eqp,
250  int icvflb,
251  int inc,
252  int imasac,
253  cs_real_t *restrict pvar,
254  const cs_real_t *restrict pvara,
255  const int icvfli[],
256  const cs_field_bc_coeffs_t *bc_coeffs,
257  const cs_real_t i_massflux[],
258  const cs_real_t b_massflux[],
259  const cs_real_t i_visc[],
260  const cs_real_t b_visc[],
261  cs_real_t *restrict rhs);
262 
263 /*----------------------------------------------------------------------------*/
264 /*
265  * \brief Update face flux with convection contribution of a standard transport
266  * equation of a scalar field \f$ \varia \f$.
267  *
268  * \f[
269  * C_\ij = \dot{m}_\ij \left( \varia_\fij - \varia_\celli \right)
270  * \f]
271  *
272  * \param[in] idtvar indicator of the temporal scheme
273  * \param[in] f_id field id (or -1)
274  * \param[in] eqp equation parameters
275  * \param[in] icvflb global indicator of boundary convection flux
276  * - 0 upwind scheme at all boundary faces
277  * - 1 imposed flux at some boundary faces
278  * \param[in] inc indicator
279  * - 0 when solving an increment
280  * - 1 otherwise
281  * \param[in] imasac take mass accumulation into account?
282  * \param[in] pvar solved variable (current time step)
283  * \param[in] pvara solved variable (previous time step)
284  * \param[in] icvfli boundary face indicator array of convection flux
285  * - 0 upwind scheme
286  * - 1 imposed flux
287  * \param[in] bc_coeffs boundary condition structure for the variable
288  * \param[in] i_massflux mass flux at interior faces
289  * \param[in] b_massflux mass flux at boundary faces
290  * \param[in,out] i_conv_flux scalar convection flux at interior faces
291  * \param[in,out] b_conv_flux scalar convection flux at boundary faces
292  */
293 /*----------------------------------------------------------------------------*/
294 
295 void
297  int f_id,
298  const cs_equation_param_t eqp,
299  int icvflb,
300  int inc,
301  int imasac,
302  cs_real_t *restrict pvar,
303  const cs_real_t *restrict pvara,
304  const int icvfli[],
305  const cs_field_bc_coeffs_t *bc_coeffs,
306  const cs_real_t i_massflux[],
307  const cs_real_t b_massflux[],
308  cs_real_2_t i_conv_flux[],
309  cs_real_t b_conv_flux[]);
310 
311 /*----------------------------------------------------------------------------*/
312 /*
313  * \brief Add the explicit part of the convection/diffusion terms of a transport
314  * equation of a vector field \f$ \vect{\varia} \f$.
315  *
316  * More precisely, the right hand side \f$ \vect{Rhs} \f$ is updated as
317  * follows:
318  * \f[
319  * \vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}} \left(
320  * \dot{m}_\ij \left( \vect{\varia}_\fij - \vect{\varia}_\celli \right)
321  * - \mu_\fij \gradt_\fij \vect{\varia} \cdot \vect{S}_\ij \right)
322  * \f]
323  *
324  * Remark:
325  * if ivisep = 1, then we also take \f$ \mu \transpose{\gradt\vect{\varia}}
326  * + \lambda \trace{\gradt\vect{\varia}} \f$, where \f$ \lambda \f$ is
327  * the secondary viscosity, i.e. usually \f$ -\frac{2}{3} \mu \f$.
328  *
329  * Warning:
330  * - \f$ \vect{Rhs} \f$ has already been initialized before calling bilsc!
331  * - mind the sign minus
332  *
333  * \param[in] idtvar indicator of the temporal scheme
334  * \param[in] f_id index of the current variable
335  * \param[in] eqp equation parameters
336  * \param[in] icvflb global indicator of boundary convection flux
337  * - 0 upwind scheme at all boundary faces
338  * - 1 imposed flux at some boundary faces
339  * \param[in] inc indicator
340  * - 0 when solving an increment
341  * - 1 otherwise
342  * \param[in] ivisep indicator to take \f$ \divv
343  * \left(\mu \gradt \transpose{\vect{a}} \right)
344  * -2/3 \grad\left( \mu \dive \vect{a} \right)\f$
345  * - 1 take into account,
346  * - 0 otherwise
347  * \param[in] imasac take mass accumulation into account?
348  * \param[in] pvar solved velocity (current time step)
349  * \param[in] pvara solved velocity (previous time step)
350  * \param[in] icvfli boundary face indicator array of convection flux
351  * - 0 upwind scheme
352  * - 1 imposed flux
353  * \param[in] bc_coeffs_v boundary conditions structure for the variable
354  * \param[in] i_massflux mass flux at interior faces
355  * \param[in] b_massflux mass flux at boundary faces
356  * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
357  * at interior faces for the r.h.s.
358  * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
359  * at border faces for the r.h.s.
360  * \param[in] i_secvis secondary viscosity at interior faces
361  * \param[in] b_secvis secondary viscosity at boundary faces
362  * \param[in] i_pvar velocity at interior faces
363  * \param[in] b_pvar velocity at boundary faces
364  * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
365  */
366 /*----------------------------------------------------------------------------*/
367 
368 void
370  int f_id,
371  const cs_equation_param_t eqp,
372  int icvflb,
373  int inc,
374  int ivisep,
375  int imasac,
376  cs_real_3_t *restrict pvar,
377  const cs_real_3_t *restrict pvara,
378  const int icvfli[],
379  const cs_field_bc_coeffs_t *bc_coeffs_v,
380  const cs_real_t i_massflux[],
381  const cs_real_t b_massflux[],
382  const cs_real_t i_visc[],
383  const cs_real_t b_visc[],
384  const cs_real_t i_secvis[],
385  const cs_real_t b_secvis[],
386  cs_real_3_t *restrict i_pvar,
387  cs_real_3_t *restrict b_pvar,
388  cs_real_3_t *restrict rhs);
389 
390 /*----------------------------------------------------------------------------*/
428 /*----------------------------------------------------------------------------*/
429 
430 void
432  int f_id,
433  const cs_equation_param_t eqp,
434  int icvflb,
435  int inc,
436  int imasac,
437  cs_real_6_t *restrict pvar,
438  const cs_real_6_t *restrict pvara,
439  const cs_field_bc_coeffs_t *bc_coeffs_ts,
440  const cs_real_t i_massflux[],
441  const cs_real_t b_massflux[],
442  const cs_real_t i_visc[],
443  const cs_real_t b_visc[],
444  cs_real_6_t *restrict rhs);
445 
446 /*----------------------------------------------------------------------------*/
481 /*----------------------------------------------------------------------------*/
482 
483 void
485  int f_id,
486  const cs_equation_param_t eqp,
487  int inc,
488  int imasac,
489  cs_real_t *restrict pvar,
490  const cs_real_t *restrict pvara,
491  const cs_field_bc_coeffs_t *bc_coeffs,
492  const cs_real_t i_massflux[],
493  const cs_real_t b_massflux[],
494  const cs_real_t i_visc[],
495  const cs_real_t b_visc[],
496  const cs_real_t xcpp[],
497  cs_real_t *restrict rhs);
498 
499 /*----------------------------------------------------------------------------*/
500 /*
501  * \brief Add the explicit part of the diffusion terms with a symmetric tensor
502  * diffusivity for a transport equation of a scalar field \f$ \varia \f$.
503  *
504  * More precisely, the right hand side \f$ Rhs \f$ is updated as
505  * follows:
506  * \f[
507  * Rhs = Rhs - \sum_{\fij \in \Facei{\celli}} \left(
508  * - \tens{\mu}_\fij \gradv_\fij \varia \cdot \vect{S}_\ij \right)
509  * \f]
510  *
511  * Warning:
512  * - \f$ Rhs \f$ has already been initialized before
513  * calling cs_anisotropic_diffusion_scalar!
514  * - mind the sign minus
515  *
516  * \param[in] idtvar indicator of the temporal scheme
517  * \param[in] f_id index of the current variable
518  * \param[in] eqp equation parameters
519  * \param[in] inc indicator
520  * - 0 when solving an increment
521  * - 1 otherwise
522  * \param[in] pvar solved variable (current time step)
523  * \param[in] pvara solved variable (previous time step)
524  * \param[in] bc_coeffs boundary condition structure for the variable
525  * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
526  * at interior faces for the r.h.s.
527  * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
528  * at border faces for the r.h.s.
529  * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
530  * \param[in] weighf internal face weight between cells i j in case
531  * of tensor diffusion
532  * \param[in] weighb boundary face weight for cells i in case
533  * of tensor diffusion
534  * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
535  */
536 /*----------------------------------------------------------------------------*/
537 
538 void
540  int f_id,
541  const cs_equation_param_t eqp,
542  int inc,
543  cs_real_t *restrict pvar,
544  const cs_real_t *restrict pvara,
545  const cs_field_bc_coeffs_t *bc_coeffs,
546  const cs_real_t i_visc[],
547  const cs_real_t b_visc[],
548  cs_real_6_t *restrict viscel,
549  const cs_real_2_t weighf[],
550  const cs_real_t weighb[],
551  cs_real_t *restrict rhs);
552 
553 /*-----------------------------------------------------------------------------*/
554 /*
555  * \brief Add explicit part of the terms of diffusion by a left-multiplying
556  * symmetric tensorial diffusivity for a transport equation of a vector field
557  * \f$ \vect{\varia} \f$.
558  *
559  * More precisely, the right hand side \f$ \vect{Rhs} \f$ is updated as
560  * follows:
561  * \f[
562  * \vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}} \left(
563  * - \gradt_\fij \vect{\varia} \tens{\mu}_\fij \cdot \vect{S}_\ij \right)
564  * \f]
565  *
566  * Remark:
567  * if ivisep = 1, then we also take \f$ \mu \transpose{\gradt\vect{\varia}}
568  * + \lambda \trace{\gradt\vect{\varia}} \f$, where \f$ \lambda \f$ is
569  * the secondary viscosity, i.e. usually \f$ -\frac{2}{3} \mu \f$.
570  *
571  * Warning:
572  * - \f$ \vect{Rhs} \f$ has already been initialized before calling the present
573  * function
574  * - mind the sign minus
575  *
576  * \param[in] idtvar indicator of the temporal scheme
577  * \param[in] f_id index of the current variable
578  * \param[in] eqp equation parameters
579  * \param[in] inc indicator
580  * - 0 when solving an increment
581  * - 1 otherwise
582  * \param[in] ivisep indicator to take \f$ \divv
583  * \left(\mu \gradt \transpose{\vect{a}} \right)
584  * -2/3 \grad\left( \mu \dive \vect{a} \right)\f$
585  * - 1 take into account,
586  * \param[in] pvar solved variable (current time step)
587  * \param[in] pvara solved variable (previous time step)
588  * \param[in] bc_coeffs_v boundary conditions structure for the variable
589  * \param[in] i_visc \f$ \tens{\mu}_\fij \dfrac{S_\fij}{\ipf\jpf} \f$
590  * at interior faces for the r.h.s.
591  * \param[in] b_visc \f$ \dfrac{S_\fib}{\ipf \centf} \f$
592  * at border faces for the r.h.s.
593  * \param[in] i_secvis secondary viscosity at interior faces
594  * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
595  */
596 /*----------------------------------------------------------------------------*/
597 
598 void
600  int f_id,
601  const cs_equation_param_t eqp,
602  int inc,
603  int ivisep,
604  cs_real_3_t *restrict pvar,
605  const cs_real_3_t *restrict pvara,
606  const cs_field_bc_coeffs_t *bc_coeffs_v,
607  const cs_real_33_t i_visc[],
608  const cs_real_t b_visc[],
609  const cs_real_t i_secvis[],
610  cs_real_3_t *restrict rhs);
611 
612 /*-----------------------------------------------------------------------------*/
613 /*
614  * \brief Add explicit part of the terms of diffusion by a right-multiplying
615  * symmetric tensorial diffusivity for a transport equation of a vector field
616  * \f$ \vect{\varia} \f$.
617  *
618  * More precisely, the right hand side \f$ \vect{Rhs} \f$ is updated as
619  * follows:
620  * \f[
621  * \vect{Rhs} = \vect{Rhs} - \sum_{\fij \in \Facei{\celli}} \left(
622  * - \gradt_\fij \vect{\varia} \tens{\mu}_\fij \cdot \vect{S}_\ij \right)
623  * \f]
624  *
625  * Warning:
626  * - \f$ \vect{Rhs} \f$ has already been initialized before calling the present
627  * function
628  * - mind the sign minus
629  *
630  * \param[in] idtvar indicator of the temporal scheme
631  * \param[in] f_id index of the current variable
632  * \param[in] eqp equation parameters
633  * \param[in] inc indicator
634  * - 0 when solving an increment
635  * - 1 otherwise
636  * \param[in] pvar solved variable (current time step)
637  * \param[in] pvara solved variable (previous time step)
638  * \param[in] bc_coeffs_v boundary condition structure for the variable
639  * \param[in] i_visc \f$ \tens{\mu}_\fij \dfrac{S_\fij}{\ipf\jpf} \f$
640  * at interior faces for the r.h.s.
641  * \param[in] b_visc \f$ \dfrac{S_\fib}{\ipf \centf} \f$
642  * at border faces for the r.h.s.
643  * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
644  * \param[in] weighf internal face weight between cells i j in case
645  * of tensor diffusion
646  * \param[in] weighb boundary face weight for cells i in case
647  * of tensor diffusion
648  * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
649  */
650 /*----------------------------------------------------------------------------*/
651 
652 void
654  int f_id,
655  const cs_equation_param_t eqp,
656  int inc,
657  cs_real_3_t *restrict pvar,
658  const cs_real_3_t *restrict pvara,
659  const cs_field_bc_coeffs_t *bc_coeffs_v,
660  const cs_real_t i_visc[],
661  const cs_real_t b_visc[],
662  cs_real_6_t *restrict viscel,
663  const cs_real_2_t weighf[],
664  const cs_real_t weighb[],
665  cs_real_3_t *restrict rhs);
666 
667 /*----------------------------------------------------------------------------*/
668 /*
669  * \brief Add the explicit part of the diffusion terms with a symmetric tensor
670  * diffusivity for a transport equation of a scalar field \f$ \varia \f$.
671  *
672  * More precisely, the right hand side \f$ Rhs \f$ is updated as
673  * follows:
674  * \f[
675  * Rhs = Rhs - \sum_{\fij \in \Facei{\celli}} \left(
676  * - \tens{\mu}_\fij \gradv_\fij \varia \cdot \vect{S}_\ij \right)
677  * \f]
678  *
679  * Warning:
680  * - \f$ Rhs \f$ has already been initialized before
681  * calling cs_anisotropic_diffusion_scalar!
682  * - mind the sign minus
683  *
684  * \param[in] idtvar indicator of the temporal scheme
685  * \param[in] f_id index of the current variable
686  * \param[in] eqp equation parameters
687  * \param[in] inc indicator
688  * - 0 when solving an increment
689  * - 1 otherwise
690  * \param[in] pvar solved variable (current time step)
691  * \param[in] pvara solved variable (previous time step)
692  * \param[in] bc_coeffs_ts boundary condition structure for the variable
693  * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
694  * at interior faces for the r.h.s.
695  * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
696  * at border faces for the r.h.s.
697  * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
698  * \param[in] weighf internal face weight between cells i j in case
699  * of tensor diffusion
700  * \param[in] weighb boundary face weight for cells i in case
701  * of tensor diffusion
702  * \param[in,out] rhs right hand side \f$ \vect{Rhs} \f$
703  */
704 /*----------------------------------------------------------------------------*/
705 
706 void
708  int f_id,
709  const cs_equation_param_t eqp,
710  int inc,
711  cs_real_6_t *restrict pvar,
712  const cs_real_6_t *restrict pvara,
713  const cs_field_bc_coeffs_t *bc_coeffs_ts,
714  const cs_real_t i_visc[],
715  const cs_real_t b_visc[],
716  cs_real_6_t *restrict viscel,
717  const cs_real_2_t weighf[],
718  const cs_real_t weighb[],
719  cs_real_6_t *restrict rhs);
720 
721 /*----------------------------------------------------------------------------*/
722 /*
723  * \brief Update the face mass flux with the face pressure (or pressure
724  * increment, or pressure double increment) gradient.
725  *
726  * \f[
727  * \dot{m}_\ij = \dot{m}_\ij
728  * - \Delta t \grad_\fij \delta p \cdot \vect{S}_\ij
729  * \f]
730  *
731  * Please refer to the
732  * <a href="../../theory.pdf#cs_face_diffusion_potential">
733  <b>cs_face_diffusion_potential/cs_diffusion_potential</b></a>
734  * section of the theory guide for more information.
735  *
736  * \param[in] f_id field id (or -1)
737  * \param[in] m pointer to mesh
738  * \param[in] fvq pointer to finite volume quantities
739  * \param[in] init indicator
740  * - 1 initialize the mass flux to 0
741  * - 0 otherwise
742  * \param[in] inc indicator
743  * - 0 when solving an increment
744  * - 1 otherwise
745  * \param[in] imrgra indicator
746  * - 0 iterative gradient
747  * - 1 least squares gradient
748  * \param[in] nswrgp number of reconstruction sweeps for the
749  * gradients
750  * \param[in] imligp clipping gradient method
751  * - < 0 no clipping
752  * - = 0 thank to neighbooring gradients
753  * - = 1 thank to the mean gradient
754  * \param[in] iphydp hydrostatic pressure indicator
755  * \param[in] iwgrp indicator
756  * - 1 weight gradient by vicosity*porosity
757  * - weighting determined by field options
758  * \param[in] iwarnp verbosity
759  * \param[in] epsrgp relative precision for the gradient
760  * reconstruction
761  * \param[in] climgp clipping coeffecient for the computation of
762  * the gradient
763  * \param[in] frcxt body force creating the hydrostatic pressure
764  * \param[in] pvar solved variable (current time step)
765  * \param[in] bc_coeffs boundary condition structure for the variable
766  * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
767  * at interior faces for the r.h.s.
768  * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
769  * at border faces for the r.h.s.
770  * \param[in] visel viscosity by cell
771  * \param[in,out] i_massflux mass flux at interior faces
772  * \param[in,out] b_massflux mass flux at boundary faces
773  */
774 /*----------------------------------------------------------------------------*/
775 
776 void
777 cs_face_diffusion_potential(const int f_id,
778  const cs_mesh_t *m,
780  int init,
781  int inc,
782  int imrgra,
783  int nswrgp,
784  int imligp,
785  int iphydp,
786  int iwgrp,
787  int iwarnp,
788  double epsrgp,
789  double climgp,
790  cs_real_3_t *restrict frcxt,
791  cs_real_t *restrict pvar,
792  const cs_field_bc_coeffs_t *bc_coeffs,
793  const cs_real_t i_visc[],
794  const cs_real_t b_visc[],
795  cs_real_t *restrict visel,
796  cs_real_t *restrict i_massflux,
797  cs_real_t *restrict b_massflux);
798 
799 /*----------------------------------------------------------------------------*/
800 /*
801  * \brief Add the explicit part of the pressure gradient term to the mass flux
802  * in case of anisotropic diffusion of the pressure field \f$ P \f$.
803  *
804  * More precisely, the mass flux side \f$ \dot{m}_\fij \f$ is updated as
805  * follows:
806  * \f[
807  * \dot{m}_\fij = \dot{m}_\fij -
808  * \left( \tens{\mu}_\fij \gradv_\fij P \cdot \vect{S}_\ij \right)
809  * \f]
810  *
811  * \param[in] f_id field id (or -1)
812  * \param[in] m pointer to mesh
813  * \param[in] fvq pointer to finite volume quantities
814  * \param[in] init indicator
815  * - 1 initialize the mass flux to 0
816  * - 0 otherwise
817  * \param[in] inc indicator
818  * - 0 when solving an increment
819  * - 1 otherwise
820  * \param[in] imrgra indicator
821  * - 0 iterative gradient
822  * - 1 least squares gradient
823  * \param[in] nswrgp number of reconstruction sweeps for the
824  * gradients
825  * \param[in] imligp clipping gradient method
826  * - < 0 no clipping
827  * - = 0 thank to neighbooring gradients
828  * - = 1 thank to the mean gradient
829  * \param[in] ircflp indicator
830  * - 1 flux reconstruction,
831  * - 0 otherwise
832  * \param[in] iphydp indicator
833  * - 1 hydrostatic pressure taken into account
834  * - 0 otherwise
835  * \param[in] iwgrp indicator
836  * - 1 weight gradient by vicosity*porosity
837  * - weighting determined by field options
838  * \param[in] iwarnp verbosity
839  * \param[in] epsrgp relative precision for the gradient
840  * reconstruction
841  * \param[in] climgp clipping coeffecient for the computation of
842  * the gradient
843  * \param[in] frcxt body force creating the hydrostatic pressure
844  * \param[in] pvar solved variable (pressure)
845  * \param[in] bc_coeffs boundary condition structure for the variable
846  * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
847  * at interior faces for the r.h.s.
848  * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
849  * at border faces for the r.h.s.
850  * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
851  * \param[in] weighf internal face weight between cells i j in case
852  * of tensor diffusion
853  * \param[in] weighb boundary face weight for cells i in case
854  * of tensor diffusion
855  * \param[in,out] i_massflux mass flux at interior faces
856  * \param[in,out] b_massflux mass flux at boundary faces
857  */
858 /*----------------------------------------------------------------------------*/
859 
860 void
862  const cs_mesh_t *m,
864  int init,
865  int inc,
866  int imrgra,
867  int nswrgp,
868  int imligp,
869  int ircflp,
870  int iphydp,
871  int iwgrp,
872  int iwarnp,
873  double epsrgp,
874  double climgp,
875  cs_real_3_t *restrict frcxt,
876  cs_real_t *restrict pvar,
877  const cs_field_bc_coeffs_t *bc_coeffs,
878  const cs_real_t i_visc[],
879  const cs_real_t b_visc[],
880  cs_real_6_t *restrict viscel,
881  const cs_real_2_t weighf[],
882  const cs_real_t weighb[],
883  cs_real_t *restrict i_massflux,
884  cs_real_t *restrict b_massflux);
885 
886 /*----------------------------------------------------------------------------*/
933 /*----------------------------------------------------------------------------*/
934 
935 void
936 cs_diffusion_potential(const int f_id,
937  const cs_mesh_t *m,
939  int init,
940  int inc,
941  int imrgra,
942  int nswrgp,
943  int imligp,
944  int iphydp,
945  int iwgrp,
946  int iwarnp,
947  double epsrgp,
948  double climgp,
949  cs_real_3_t *restrict frcxt,
950  cs_real_t *restrict pvar,
951  const cs_field_bc_coeffs_t *bc_coeffs,
952  const cs_real_t i_visc[],
953  const cs_real_t b_visc[],
954  cs_real_t visel[],
955  cs_real_t *restrict diverg);
956 
957 /*----------------------------------------------------------------------------*/
958 /*
959  * \brief Add the explicit part of the divergence of the mass flux due to the
960  * pressure gradient (routine analog to diften).
961  *
962  * More precisely, the divergence of the mass flux side
963  * \f$ \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij \f$ is updated as follows:
964  * \f[
965  * \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij
966  * = \sum_{\fij \in \Facei{\celli}} \dot{m}_\fij
967  * - \sum_{\fij \in \Facei{\celli}}
968  * \left( \tens{\mu}_\fij \gradv_\fij P \cdot \vect{S}_\ij \right)
969  * \f]
970  *
971  * \param[in] f_id field id (or -1)
972  * \param[in] m pointer to mesh
973  * \param[in] fvq pointer to finite volume quantities
974  * \param[in] init indicator
975  * - 1 initialize the mass flux to 0
976  * - 0 otherwise
977  * \param[in] inc indicator
978  * - 0 when solving an increment
979  * - 1 otherwise
980  * \param[in] imrgra indicator
981  * - 0 iterative gradient
982  * - 1 least squares gradient
983  * \param[in] nswrgp number of reconstruction sweeps for the
984  * gradients
985  * \param[in] imligp clipping gradient method
986  * - < 0 no clipping
987  * - = 0 thank to neighbooring gradients
988  * - = 1 thank to the mean gradient
989  * \param[in] ircflp indicator
990  * - 1 flux reconstruction,
991  * - 0 otherwise
992  * \param[in] iphydp indicator
993  * - 1 hydrostatic pressure taken into account
994  * - 0 otherwise
995  * \param[in] iwgrp indicator
996  * - 1 weight gradient by vicosity*porosity
997  * - weighting determined by field options
998  * \param[in] iwarnp verbosity
999  * \param[in] epsrgp relative precision for the gradient
1000  * reconstruction
1001  * \param[in] climgp clipping coeffecient for the computation of
1002  * the gradient
1003  * \param[in] frcxt body force creating the hydrostatic pressure
1004  * \param[in] pvar solved variable (pressure)
1005  * \param[in] bc_coeffs boundary condition structure for the variable
1006  * \param[in] i_visc \f$ \mu_\fij \dfrac{S_\fij}{\ipf \jpf} \f$
1007  * at interior faces for the r.h.s.
1008  * \param[in] b_visc \f$ \mu_\fib \dfrac{S_\fib}{\ipf \centf} \f$
1009  * at border faces for the r.h.s.
1010  * \param[in] viscel symmetric cell tensor \f$ \tens{\mu}_\celli \f$
1011  * \param[in] weighf internal face weight between cells i j in case
1012  * of tensor diffusion
1013  * \param[in] weighb boundary face weight for cells i in case
1014  * of tensor diffusion
1015  * \param[in,out] diverg divergence of the mass flux
1016  */
1017 /*----------------------------------------------------------------------------*/
1018 
1019 void
1020 cs_anisotropic_diffusion_potential(const int f_id,
1021  const cs_mesh_t *m,
1022  cs_mesh_quantities_t *fvq,
1023  int init,
1024  int inc,
1025  int imrgra,
1026  int nswrgp,
1027  int imligp,
1028  int ircflp,
1029  int iphydp,
1030  int iwgrp,
1031  int iwarnp,
1032  double epsrgp,
1033  double climgp,
1034  cs_real_3_t *restrict frcxt,
1035  cs_real_t *restrict pvar,
1036  const cs_field_bc_coeffs_t *bc_coeffs,
1037  const cs_real_t i_visc[],
1038  const cs_real_t b_visc[],
1039  cs_real_6_t *restrict viscel,
1040  const cs_real_2_t weighf[],
1041  const cs_real_t weighb[],
1042  cs_real_t *restrict diverg);
1043 
1044 /*----------------------------------------------------------------------------*/
1045 
1047 
1048 #endif /* __CS_CONVECTION_DIFFUSION_H__ */
void cs_anisotropic_diffusion_tensor(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_6_t *restrict pvar, const cs_real_6_t *restrict 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 *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.cpp:10118
void cs_cell_courant_number(const int f_id, cs_real_t *courant)
Definition: cs_convection_diffusion.cpp:6967
void cs_anisotropic_diffusion_scalar(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_t *restrict pvar, const cs_real_t *restrict 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 *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.cpp:8126
cs_real_t * cs_get_v_slope_test(int f_id, const cs_equation_param_t eqp)
Definition: cs_convection_diffusion.cpp:7053
void cs_anisotropic_right_diffusion_vector(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict 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 *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.cpp:9412
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 *restrict pvar, const cs_real_3_t *restrict 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 *restrict rhs)
Add explicit part of the terms of diffusion by a left-multiplying symmetric tensorial diffusivity for...
Definition: cs_convection_diffusion.cpp:8871
cs_nvd_type_t
Definition: cs_convection_diffusion.h:123
@ CS_NVD_SUPERBEE
Definition: cs_convection_diffusion.h:128
@ CS_NVD_SMART
Definition: cs_convection_diffusion.h:126
@ CS_NVD_CUBISTA
Definition: cs_convection_diffusion.h:127
@ CS_NVD_STOIC
Definition: cs_convection_diffusion.h:132
@ CS_NVD_WASEB
Definition: cs_convection_diffusion.h:134
@ CS_NVD_CLAM
Definition: cs_convection_diffusion.h:131
@ CS_NVD_OSHER
Definition: cs_convection_diffusion.h:133
@ CS_NVD_VOF_CICSAM
Definition: cs_convection_diffusion.h:136
@ CS_NVD_VOF_STACS
Definition: cs_convection_diffusion.h:137
@ CS_NVD_GAMMA
Definition: cs_convection_diffusion.h:125
@ CS_NVD_MINMOD
Definition: cs_convection_diffusion.h:130
@ CS_NVD_VOF_HRIC
Definition: cs_convection_diffusion.h:135
@ CS_NVD_MUSCL
Definition: cs_convection_diffusion.h:129
@ CS_NVD_N_TYPES
Definition: cs_convection_diffusion.h:138
void cs_face_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int ircflp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_field_bc_coeffs_t *bc_coeffs, 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.cpp:11018
void cs_convection_diffusion_thermal(int idtvar, int f_id, const cs_equation_param_t eqp, int inc, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict 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 *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a scalar field su...
Definition: cs_convection_diffusion.cpp:8038
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 *restrict pvar, const cs_real_t *restrict 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_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int ircflp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_field_bc_coeffs_t *bc_coeffs, 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.cpp:11765
void cs_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_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 *restrict diverg)
Update the cell mass flux divergence with the face pressure (or pressure increment,...
Definition: cs_convection_diffusion.cpp:11442
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 *restrict pvar, const cs_real_t *restrict 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 *restrict rhs)
Add the explicit part of the convection/diffusion terms of a standard transport equation of a scalar ...
Definition: cs_convection_diffusion.cpp:7241
void cs_face_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_field_bc_coeffs_t *bc_coeffs, 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.cpp:10720
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 *restrict pvar, const cs_real_6_t *restrict 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 *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a tensor field .
Definition: cs_convection_diffusion.cpp:7852
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 *restrict pvar, const cs_real_3_t *restrict 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 *restrict i_pvar, cs_real_3_t *restrict b_pvar, cs_real_3_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a vector field .
Definition: cs_convection_diffusion.cpp:7456
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:7102
#define restrict
Definition: cs_defs.h:141
#define BEGIN_C_DECLS
Definition: cs_defs.h:528
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:347
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:346
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:349
#define END_C_DECLS
Definition: cs_defs.h:529
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:356
cs_halo_type_t
Definition: cs_halo.h:56
integer, dimension(:), allocatable, target icvfli
boundary convection flux indicator of a Rusanov or an analytical flux (some boundary contributions of...
Definition: cfpoin.f90:55
integer(c_int), pointer, save imrgra
type of gradient reconstruction
Definition: optcal.f90:137
integer(c_int), pointer, save idtvar
option for a variable time step
Definition: optcal.f90:260
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:193
Field boundary condition descriptor (for variables)
Definition: cs_field.h:104
Definition: cs_mesh_quantities.h:92
Definition: cs_mesh.h:85