1 /*============================================================================
2  * Routines to handle basic parameter types
3  *============================================================================*/
4 
5 /*
6   This file is part of Code_Saturne, a general-purpose CFD tool.
7 
8   Copyright (C) 1998-2021 EDF S.A.
9 
10   This program is free software; you can redistribute it and/or modify it under
11   the terms of the GNU General Public License as published by the Free Software
12   Foundation; either version 2 of the License, or (at your option) any later
13   version.
14 
15   This program is distributed in the hope that it will be useful, but WITHOUT
16   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18   details.
19 
20   You should have received a copy of the GNU General Public License along with
21   this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
22   Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24 
25 /*----------------------------------------------------------------------------*/
26 
27 /*----------------------------------------------------------------------------
28  * Standard C library headers
29  *----------------------------------------------------------------------------*/
30 
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <string.h>
34 #include <assert.h>
35 
36 /*----------------------------------------------------------------------------
37  *  Local headers
38  *----------------------------------------------------------------------------*/
39 
40 #include "bft_mem.h"
41 
42 #include "cs_base.h"
43 #include "cs_log.h"
44 
45 /*----------------------------------------------------------------------------
46  * Header for the current file
47  *----------------------------------------------------------------------------*/
48 
49 #include "cs_param_types.h"
50 
51 /*----------------------------------------------------------------------------*/
52 
53 BEGIN_C_DECLS
54 
55 /*=============================================================================
56  * Local Macro definitions and structure definitions
57  *============================================================================*/
58 
59 #define CS_PARAM_TYPES_DBG  0
60 
61 /*============================================================================
62  * Global variables
63  *============================================================================*/
64 
65 /* Separation lines: long, medium, short */
66 const char cs_sep_h1[80] =
67   "=======================================================================\n";
68 const char cs_sep_h2[80] =
69   "-----------------------------------------------------------------------\n";
70 const char cs_sepline[80] =
71   "# =====================================================================\n";
72 const char cs_med_sepline[50] =
73   "# ========================================\n";
74 
75 /*============================================================================
76  * Global static variables
77  *============================================================================*/
78 
79 static const char
80 cs_param_space_scheme_name[CS_SPACE_N_SCHEMES][CS_BASE_STRING_LEN] =
81   { N_("Legacy Finite Volume"),
82     N_("CDO vertex-based"),
83     N_("CDO vertex+cell-based"),
84     N_("CDO edge-based"),
85     N_("CDO face-based"),
86     N_("HHO-P0"),
87     N_("HHO-P1"),
88     N_("HHO-P2")
89   };
90 
91 static const char
92 cs_param_time_scheme_name[CS_TIME_N_SCHEMES][CS_BASE_STRING_LEN] =
93   { N_("Steady-state"),
94     N_("1st order Forward Euler (Implicit)"),
95     N_("1st order Backward Euler (Explicit)"),
96     N_("Crank-Nicolson"),
97     N_("Theta scheme"),
98     N_("BDF2 (Implicit, 2nd order)")
99   };
100 
101 static const char
102 cs_param_adv_form_name[CS_PARAM_N_ADVECTION_FORMULATIONS][CS_BASE_STRING_LEN] =
103   { N_("Conservative"),
104     N_("Non-Conservative"),
105     N_("Skew-symmetric"),
106   };
107 
108 static const char
109 cs_param_adv_scheme_name[CS_PARAM_N_ADVECTION_SCHEMES][CS_BASE_STRING_LEN] =
110   { N_("Centered"),
111     N_("Continuous interior penalty"),
112     N_("Continuous interior penalty (cellwise)"),
113     N_("Hybrid centered-upwind"),
114     N_("Upwind with the Samarskii weight function "),
115     N_("Upwind with the Scharfetter-Gummel weight function"),
116     N_("Upwind"),
117   };
118 
119 static const char
120 cs_param_adv_strategy_name
121 [CS_PARAM_N_ADVECTION_STRATEGIES][CS_BASE_STRING_LEN] =
122   { N_("Fully implicit"),
123     N_("Linearized (implicit)"),
124     N_("Explicit"),
125   };
126 
127 static const char
128 cs_param_adv_extrapol_name
129 [CS_PARAM_N_ADVECTION_EXTRAPOLATIONS][CS_BASE_STRING_LEN] =
130   { N_("None"),
131     N_("2nd order Taylor expansion"),
132     N_("2nd order Adams-Bashforth technique"),
133   };
134 
135 static const char
136 cs_param_bc_type_name[CS_PARAM_N_BC_TYPES][CS_BASE_STRING_LEN] =
137   { N_("Homogeneous Dirichlet"),
138     N_("Dirichlet"),
139     N_("Homogeneous Neumann"),
140     N_("Neumann"),
141     N_("Neumann (full)"),
142     N_("Robin"),
143     N_("Sliding")
144   };
145 
146 static const char
147 cs_param_bc_enforcement_name[CS_PARAM_N_BC_ENFORCEMENTS][CS_BASE_STRING_LEN] =
148   { N_("weak using an algebraic manipulation"),
149     N_("weak using a big penalization coefficient"),
150     N_("weak using the Nitsche method"),
151     N_("weak using the symmetrized Nitsche method") };
152 
153 static const char
154 cs_param_nl_algo_name[CS_PARAM_N_NL_ALGOS][CS_BASE_STRING_LEN] =
155   { N_("Picard (or fixed-point) algorithm"),
156     N_("Anderson acceleration algorithm"),
157   };
158 
159 static const char
160 cs_param_precond_block_name[CS_PARAM_N_PCD_BLOCK_TYPES][CS_BASE_STRING_LEN] =
161   { N_("No block preconditioner"),
162     N_("Diagonal block preconditioner"),
163     N_("Full diagonal block preconditioner"),
164     N_("Full lower triangular block preconditioner"),
165     N_("Full symmetric Gauss-Seidel block preconditioner"),
166     N_("Full upper triangular block preconditioner"),
167     N_("Lower triangular block preconditioner"),
168     N_("Symmetric Gauss-Seidel block preconditioner"),
169     N_("Upper triangular block preconditioner"),
170     N_("Uzawa block preconditioner") };
171 
172 static const char
173 cs_param_schur_approx_name[CS_PARAM_N_SCHUR_APPROX][CS_BASE_STRING_LEN] =
174   { N_("None"),
175     N_("Based on the diagonal"),
176     N_("Elman'99"),
177     N_("Identity matrix"),
178     N_("Lumped inverse"),
179     N_("Scaled mass matrix"),
180     N_("Based on the diagonal + mass scaling"),
181     N_("Lumped inverse + mass scaling") };
182 
183 static const char
184 cs_param_dotprod_name[CS_PARAM_N_DOTPROD_TYPES][CS_BASE_STRING_LEN] =
185   { N_("Classical Euclidean"),
186     N_("Based on CDO quantities"),
187   };
188 
189 
190 /*! \cond DOXYGEN_SHOULD_SKIP_THIS */
191 
192 /*============================================================================
193  * Private function prototypes
194  *============================================================================*/
195 
196 /*! (DOXYGEN_SHOULD_SKIP_THIS) \endcond */
197 
198 /*============================================================================
199  * Public function prototypes
200  *============================================================================*/
201 
202 /*----------------------------------------------------------------------------*/
203 /*!
204  * \brief   Return true if the space scheme has degrees of freedom on faces,
205  *          otherwise false
206  *
207  * \param[in] scheme      type of space scheme
208  *
209  * \return true or false
210  */
211 /*----------------------------------------------------------------------------*/
212 
213 bool
cs_param_space_scheme_is_face_based(cs_param_space_scheme_t scheme)214 cs_param_space_scheme_is_face_based(cs_param_space_scheme_t    scheme)
215 {
216   if (scheme == CS_SPACE_SCHEME_CDOFB  ||
217       scheme == CS_SPACE_SCHEME_HHO_P0 ||
218       scheme == CS_SPACE_SCHEME_HHO_P1 ||
219       scheme == CS_SPACE_SCHEME_HHO_P2)
220     return true;
221   else
222     return false;
223 }
224 
225 /*----------------------------------------------------------------------------*/
226 /*!
227  * \brief   Get the name of the space discretization scheme
228  *
229  * \param[in] scheme      type of space scheme
230  *
231  * \return the associated space scheme name
232  */
233 /*----------------------------------------------------------------------------*/
234 
235 const char *
cs_param_get_space_scheme_name(cs_param_space_scheme_t scheme)236 cs_param_get_space_scheme_name(cs_param_space_scheme_t    scheme)
237 {
238   switch (scheme) {
239   case CS_SPACE_SCHEME_LEGACY:
240   case CS_SPACE_SCHEME_CDOVB:
241   case CS_SPACE_SCHEME_CDOVCB:
242   case CS_SPACE_SCHEME_CDOEB:
243   case CS_SPACE_SCHEME_CDOFB:
244   case CS_SPACE_SCHEME_HHO_P0:
245   case CS_SPACE_SCHEME_HHO_P1:
246   case CS_SPACE_SCHEME_HHO_P2:
247     return cs_param_space_scheme_name[scheme];
248 
249   default:
250     return NULL;
251   }
252 }
253 
254 /*----------------------------------------------------------------------------*/
255 /*!
256  * \brief   Get the name of the time discretization scheme
257  *
258  * \param[in] scheme      type of time scheme
259  *
260  * \return the associated time scheme name
261  */
262 /*----------------------------------------------------------------------------*/
263 
264 const char *
cs_param_get_time_scheme_name(cs_param_time_scheme_t scheme)265 cs_param_get_time_scheme_name(cs_param_time_scheme_t    scheme)
266 {
267   switch (scheme) {
268   case CS_TIME_SCHEME_STEADY:
269   case CS_TIME_SCHEME_EULER_IMPLICIT:
270   case CS_TIME_SCHEME_EULER_EXPLICIT:
271   case CS_TIME_SCHEME_CRANKNICO:
272   case CS_TIME_SCHEME_THETA:
273   case CS_TIME_SCHEME_BDF2:
274     return cs_param_time_scheme_name[scheme];
275 
276   default:
277     return NULL;
278   }
279 }
280 
281 /*----------------------------------------------------------------------------*/
282 /*!
283  * \brief   Get the label associated to the advection formulation
284  *
285  * \param[in] adv_form      type of advection formulation
286  *
287  * \return the associated label
288  */
289 /*----------------------------------------------------------------------------*/
290 
291 const char *
cs_param_get_advection_form_name(cs_param_advection_form_t adv_form)292 cs_param_get_advection_form_name(cs_param_advection_form_t    adv_form)
293 {
294   switch (adv_form) {
295   case CS_PARAM_ADVECTION_FORM_CONSERV:
296   case CS_PARAM_ADVECTION_FORM_NONCONS:
297   case CS_PARAM_ADVECTION_FORM_SKEWSYM:
298     return cs_param_adv_form_name[adv_form];
299 
300   default:
301     return NULL;
302   }
303 }
304 
305 /*----------------------------------------------------------------------------*/
306 /*!
307  * \brief   Get the label of the advection scheme
308  *
309  * \param[in] scheme      type of advection scheme
310  *
311  * \return the associated advection scheme label
312  */
313 /*----------------------------------------------------------------------------*/
314 
315 const char *
cs_param_get_advection_scheme_name(cs_param_advection_scheme_t scheme)316 cs_param_get_advection_scheme_name(cs_param_advection_scheme_t    scheme)
317 {
318   switch (scheme) {
319   case CS_PARAM_ADVECTION_SCHEME_CENTERED:
320   case CS_PARAM_ADVECTION_SCHEME_CIP:
321   case CS_PARAM_ADVECTION_SCHEME_CIP_CW:
322   case CS_PARAM_ADVECTION_SCHEME_HYBRID_CENTERED_UPWIND:
323   case CS_PARAM_ADVECTION_SCHEME_SAMARSKII:
324   case CS_PARAM_ADVECTION_SCHEME_SG:
325   case CS_PARAM_ADVECTION_SCHEME_UPWIND:
326     return cs_param_adv_scheme_name[scheme];
327 
328   default:
329     return NULL;
330   }
331 }
332 
333 /*----------------------------------------------------------------------------*/
334 /*!
335  * \brief   Get the label associated to the advection strategy
336  *
337  * \param[in] adv_stra      type of advection strategy
338  *
339  * \return the associated label
340  */
341 /*----------------------------------------------------------------------------*/
342 
343 const char *
cs_param_get_advection_strategy_name(cs_param_advection_strategy_t adv_stra)344 cs_param_get_advection_strategy_name(cs_param_advection_strategy_t   adv_stra)
345 {
346   switch (adv_stra) {
347   case CS_PARAM_ADVECTION_IMPLICIT_FULL:
348   case CS_PARAM_ADVECTION_IMPLICIT_LINEARIZED:
349   case CS_PARAM_ADVECTION_EXPLICIT:
350     return cs_param_adv_strategy_name[adv_stra];
351 
352   default:
353     return NULL;
354   }
355 }
356 
357 /*----------------------------------------------------------------------------*/
358 /*!
359  * \brief  Get the label associated to the extrapolation used for the advection
360  *         field
361  *
362  * \param[in] adv_stra      type of extrapolation for the advection field
363  *
364  * \return the associated label
365  */
366 /*----------------------------------------------------------------------------*/
367 
368 const char *
cs_param_get_advection_extrapol_name(cs_param_advection_extrapol_t extrapol)369 cs_param_get_advection_extrapol_name(cs_param_advection_extrapol_t   extrapol)
370 {
371   switch (extrapol) {
372   case CS_PARAM_ADVECTION_EXTRAPOL_NONE:
373   case CS_PARAM_ADVECTION_EXTRAPOL_TAYLOR_2:
374   case CS_PARAM_ADVECTION_EXTRAPOL_ADAMS_BASHFORTH_2:
375     return cs_param_adv_extrapol_name[extrapol];
376 
377   default:
378     return NULL;
379   }
380 }
381 
382 /*----------------------------------------------------------------------------*/
383 /*!
384  * \brief   Get the name of the type of boundary condition
385  *
386  * \param[in] type     type of boundary condition
387  *
388  * \return the associated bc name
389  */
390 /*----------------------------------------------------------------------------*/
391 
392 const char *
cs_param_get_bc_name(cs_param_bc_type_t type)393 cs_param_get_bc_name(cs_param_bc_type_t    type)
394 {
395   switch (type) {
396   case CS_PARAM_BC_HMG_DIRICHLET:
397   case CS_PARAM_BC_DIRICHLET:
398   case CS_PARAM_BC_HMG_NEUMANN:
399   case CS_PARAM_BC_NEUMANN:
400   case CS_PARAM_BC_NEUMANN_FULL:
401   case CS_PARAM_BC_ROBIN:
402   case CS_PARAM_BC_SLIDING:
403   case CS_PARAM_BC_CIRCULATION:
404     return cs_param_bc_type_name[type];
405 
406   default:
407     return NULL;
408   }
409 }
410 
411 /*----------------------------------------------------------------------------*/
412 /*!
413  * \brief   Get the name of the type of enforcement of the boundary condition
414  *
415  * \param[in] type    type of enforcement of boundary conditions
416  *
417  * \return the associated name
418  */
419 /*----------------------------------------------------------------------------*/
420 
421 const char *
cs_param_get_bc_enforcement_name(cs_param_bc_enforce_t type)422 cs_param_get_bc_enforcement_name(cs_param_bc_enforce_t  type)
423 {
424   switch (type) {
425   case CS_PARAM_BC_ENFORCE_ALGEBRAIC:
426   case CS_PARAM_BC_ENFORCE_PENALIZED:
427   case CS_PARAM_BC_ENFORCE_WEAK_NITSCHE:
428   case CS_PARAM_BC_ENFORCE_WEAK_SYM:
429     return cs_param_bc_enforcement_name[type];
430 
431   default:
432     return NULL;
433   }
434 }
435 
436 /*----------------------------------------------------------------------------*/
437 /*!
438  * \brief   Get the name of the non-linear algorithm
439  *
440  * \param[in] algo     type of algorithm
441  *
442  * \return the associated algorithm name
443  */
444 /*----------------------------------------------------------------------------*/
445 
446 const char *
cs_param_get_nl_algo_name(cs_param_nl_algo_t algo)447 cs_param_get_nl_algo_name(cs_param_nl_algo_t   algo)
448 {
449   switch (algo) {
450   case CS_PARAM_NL_ALGO_PICARD:
451   case CS_PARAM_NL_ALGO_ANDERSON:
452     return cs_param_nl_algo_name[algo];
453 
454   default:
455     return NULL;
456   }
457 }
458 
459 /*----------------------------------------------------------------------------*/
460 /*!
461  * \brief   Get the name of the type of dot product to apply
462  *
463  * \param[in] dp_type     type of dot product
464  *
465  * \return the associated type name
466  */
467 /*----------------------------------------------------------------------------*/
468 
469 const char *
cs_param_get_dotprod_type_name(cs_param_dotprod_type_t dp_type)470 cs_param_get_dotprod_type_name(cs_param_dotprod_type_t   dp_type)
471 {
472   switch (dp_type) {
473   case CS_PARAM_DOTPROD_EUCLIDEAN:
474   case CS_PARAM_DOTPROD_CDO:
475     return cs_param_dotprod_name[dp_type];
476 
477   default:
478     return NULL;
479   }
480 }
481 
482 /*----------------------------------------------------------------------------*/
483 /*!
484  * \brief   Get the name of the solver
485  *
486  * \param[in] solver     type of iterative solver
487  *
488  * \return the associated solver name
489  */
490 /*----------------------------------------------------------------------------*/
491 
492 const char *
cs_param_get_solver_name(cs_param_itsol_type_t solver)493 cs_param_get_solver_name(cs_param_itsol_type_t  solver)
494 {
495   switch (solver) {
496 
497   case CS_PARAM_ITSOL_NONE:
498     return "None (PreOnly)";
499     break;
500 
501   case CS_PARAM_ITSOL_AMG:
502     return "Algebraic.Multigrid";
503     break;
504   case CS_PARAM_ITSOL_BICG:
505     return "BiCG";
506     break;
507   case CS_PARAM_ITSOL_BICGSTAB2:
508     return "BiCGstab2";
509     break;
510   case CS_PARAM_ITSOL_CG:
511     return "CG";
512     break;
513   case CS_PARAM_ITSOL_CR3:
514     return "Conjugate.Residual.3Layers";
515     break;
516   case CS_PARAM_ITSOL_FCG:
517     return "Flexible.CG";
518     break;
519   case CS_PARAM_ITSOL_FGMRES:
520     return "Flexible.GMRES";
521     break;
522   case CS_PARAM_ITSOL_GAUSS_SEIDEL:
523     return "Gauss.Seidel";
524     break;
525   case CS_PARAM_ITSOL_GCR:
526     return "Generalized Conjugate Residual";
527     break;
528   case CS_PARAM_ITSOL_GKB_CG:
529     return "Golub-Kahan.BiOrthogonalization.with.CG.(inner.solver)";
530     break;
531   case CS_PARAM_ITSOL_GKB_GMRES:
532     return "Golub-Kahan.BiOrthogonalization.with.GMRES.(inner.solver)";
533     break;
534   case CS_PARAM_ITSOL_GMRES:
535     return "GMRES";
536     break;
537   case CS_PARAM_ITSOL_JACOBI:
538     return "Jacobi";
539     break;
540   case CS_PARAM_ITSOL_MINRES:
541     return "MinRes";
542     break;
543   case CS_PARAM_ITSOL_MUMPS:
544     return "MUMPS (LU factorization)";
545     break;
546   case CS_PARAM_ITSOL_MUMPS_FLOAT:
547     return "MUMPS (LU factorization) with float";
548     break;
549   case CS_PARAM_ITSOL_MUMPS_FLOAT_LDLT:
550     return "MUMPS (LDLT factorization) with float";
551     break;
552   case CS_PARAM_ITSOL_MUMPS_LDLT:
553     return "MUMPS (LDLT factorization)";
554     break;
555   case CS_PARAM_ITSOL_SYM_GAUSS_SEIDEL:
556     return "Symmetric.Gauss.Seidel";
557     break;
558   case CS_PARAM_ITSOL_USER_DEFINED:
559     return "User-defined iterative solver";
560     break;
561 
562   default:
563     bft_error(__FILE__, __LINE__, 0,
564               _(" %s: Invalid solver. Stop execution."), __func__);
565   }
566 
567   return "";
568 }
569 
570 /*----------------------------------------------------------------------------*/
571 /*!
572  * \brief   Get the name of the preconditioner
573  *
574  * \param[in] precond     type of preconditioner
575  *
576  * \return the associated preconditioner name
577  */
578 /*----------------------------------------------------------------------------*/
579 
580 const char *
cs_param_get_precond_name(cs_param_precond_type_t precond)581 cs_param_get_precond_name(cs_param_precond_type_t  precond)
582 {
583   switch (precond) {
584 
585   case CS_PARAM_PRECOND_NONE:
586     return  "None";
587     break;
588 
589   case CS_PARAM_PRECOND_BJACOB_ILU0:
590     return  "Block-Jacobi with ILU0 in each block";
591     break;
592   case CS_PARAM_PRECOND_BJACOB_SGS:
593     return  "Block-Jacobi with symmetric Gauss-Seidel in each block";
594     break;
595   case CS_PARAM_PRECOND_AMG:
596     return  "Algebraic.MultiGrid";
597     break;
598   case CS_PARAM_PRECOND_DIAG:
599     return  "Diagonal";
600     break;
601   case CS_PARAM_PRECOND_GKB_CG:
602     return "Golub-Kahan.BiOrthogonalization.with.CG.(inner.solver)";
603     break;
604   case CS_PARAM_PRECOND_GKB_GMRES:
605     return "Golub-Kahan.BiOrthogonalization.with.GMRES.(inner.solver)";
606     break;
607   case CS_PARAM_PRECOND_LU:
608     return  "LU";
609     break;
610   case CS_PARAM_PRECOND_ILU0:
611     return  "ILU0";
612     break;
613   case CS_PARAM_PRECOND_ICC0:
614     return  "ICC0";
615     break;
616   case CS_PARAM_PRECOND_POLY1:
617     return  "Neumann.Poly.O1";
618     break;
619   case CS_PARAM_PRECOND_POLY2:
620     return  "Neumann.Poly.O2";
621     break;
622   case CS_PARAM_PRECOND_SSOR:
623     return  "SSOR";
624     break;
625 
626   default:
627     bft_error(__FILE__, __LINE__, 0,
628               _(" %s: Invalid preconditioner. Stop execution."), __func__);
629   }
630 
631   return "";
632 }
633 
634 /*----------------------------------------------------------------------------*/
635 /*!
636  * \brief   Get the name of the type of block preconditioning
637  *
638  * \param[in] type     type of block preconditioning
639  *
640  * \return the associated type name
641  */
642 /*----------------------------------------------------------------------------*/
643 
644 const char *
cs_param_get_precond_block_name(cs_param_precond_block_t type)645 cs_param_get_precond_block_name(cs_param_precond_block_t   type)
646 {
647   switch (type) {
648   case CS_PARAM_PRECOND_BLOCK_NONE:
649   case CS_PARAM_PRECOND_BLOCK_DIAG:
650   case CS_PARAM_PRECOND_BLOCK_FULL_DIAG:
651   case CS_PARAM_PRECOND_BLOCK_FULL_LOWER_TRIANGULAR:
652   case CS_PARAM_PRECOND_BLOCK_FULL_SYM_GAUSS_SEIDEL:
653   case CS_PARAM_PRECOND_BLOCK_FULL_UPPER_TRIANGULAR:
654   case CS_PARAM_PRECOND_BLOCK_LOWER_TRIANGULAR:
655   case CS_PARAM_PRECOND_BLOCK_SYM_GAUSS_SEIDEL:
656   case CS_PARAM_PRECOND_BLOCK_UPPER_TRIANGULAR:
657   case CS_PARAM_PRECOND_BLOCK_UZAWA:
658     return cs_param_precond_block_name[type];
659 
660   default:
661     return NULL;
662   }
663 }
664 
665 /*----------------------------------------------------------------------------*/
666 /*!
667  * \brief   Get the name of the type of Schur complement approximation
668  *
669  * \param[in] type     type of Schur complement approximation
670  *
671  * \return the associated type name
672  */
673 /*----------------------------------------------------------------------------*/
674 
675 const char *
cs_param_get_schur_approx_name(cs_param_schur_approx_t type)676 cs_param_get_schur_approx_name(cs_param_schur_approx_t   type)
677 {
678   switch (type) {
679   case CS_PARAM_SCHUR_NONE:
680   case CS_PARAM_SCHUR_IDENTITY:
681   case CS_PARAM_SCHUR_MASS_SCALED:
682   case CS_PARAM_SCHUR_DIAG_INVERSE:
683   case CS_PARAM_SCHUR_MASS_SCALED_DIAG_INVERSE:
684   case CS_PARAM_SCHUR_LUMPED_INVERSE:
685   case CS_PARAM_SCHUR_MASS_SCALED_LUMPED_INVERSE:
686   case CS_PARAM_SCHUR_ELMAN:
687     return cs_param_schur_approx_name[type];
688 
689   default:
690     return NULL;
691   }
692 }
693 
694 /*----------------------------------------------------------------------------*/
695 /*!
696  * \brief   Get the name of the type of algebraic multigrid (AMG)
697  *
698  * \param[in] type     type of AMG
699  *
700  * \return the associated type name
701  */
702 /*----------------------------------------------------------------------------*/
703 
704 const char *
cs_param_get_amg_type_name(cs_param_amg_type_t type)705 cs_param_get_amg_type_name(cs_param_amg_type_t   type)
706 {
707   switch (type) {
708 
709   case CS_PARAM_AMG_NONE:
710     return  "None";
711     break;
712   case CS_PARAM_AMG_HYPRE_BOOMER_V:
713     return  "Boomer V-cycle (Hypre)";
714     break;
715   case CS_PARAM_AMG_HYPRE_BOOMER_W:
716     return  "Boomer W-cycle (Hypre)";
717     break;
718   case CS_PARAM_AMG_PETSC_GAMG_V:
719     return  "GAMG V-cycle (PETSc)";
720     break;
721   case CS_PARAM_AMG_PETSC_GAMG_W:
722     return  "GAMG W-cycle (PETSc)";
723     break;
724   case CS_PARAM_AMG_PETSC_PCMG:
725     return  "PCMG (PETSc)";
726     break;
727   case CS_PARAM_AMG_HOUSE_V:
728     return  "In-house (V-cycle)";
729     break;
730   case CS_PARAM_AMG_HOUSE_K:
731     return  "In-house (K-cycle)";
732     break;
733   default:
734     bft_error(__FILE__, __LINE__, 0,
735               _(" %s: Invalid type of AMG. Stop execution."), __func__);
736   }
737 
738   return "";
739 }
740 
741 /*----------------------------------------------------------------------------*/
742 
743 END_C_DECLS
744