/usr/share/code_saturne/user_examples/cs_user_cdo_numerics-examples.c is in code-saturne-data 4.3.3+repack-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | /*============================================================================
* Set advanced numerical parameters for the current simulation when the CDO
* kernel is used
*============================================================================*/
/* Code_Saturne version 4.3.3 */
/*
This file is part of Code_Saturne, a general-purpose CFD tool.
Copyright (C) 1998-2016 EDF S.A.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*----------------------------------------------------------------------------*/
#include "cs_defs.h"
/*----------------------------------------------------------------------------
* Standard C library headers
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Local headers
*----------------------------------------------------------------------------*/
#include "cs_equation.h"
#include "cs_domain.h"
/*----------------------------------------------------------------------------
* Header for the current file
*----------------------------------------------------------------------------*/
#include "cs_prototypes.h"
/*----------------------------------------------------------------------------*/
BEGIN_C_DECLS
/*=============================================================================
* Additional doxygen documentation
*============================================================================*/
/*----------------------------------------------------------------------------*/
/*!
* \file cs_user_cdo_numerics-examples.c
*
* \brief Set advanced parameters about the numerical schemes for each
* equation to solve.
* Useful to change the default behaviour.
*/
/*----------------------------------------------------------------------------*/
/*! \cond DOXYGEN_SHOULD_SKIP_THIS */
/*=============================================================================
* Local Macro definitions and structure definitions
*============================================================================*/
/*============================================================================
* Private user function definitions
*============================================================================*/
/*============================================================================
* User function definitions
*============================================================================*/
/*----------------------------------------------------------------------------*/
/*!
* \brief Setup advanced features concerning the way geometric quantities
* are built
*
* \return the type of computation to evaluate the cell center
*/
/*----------------------------------------------------------------------------*/
cs_cdo_cc_algo_t
cs_user_cdo_geometric_settings(void)
{
/* Algorithm for computing cell centers */
/* ==================================== */
/* Choice between:
CS_CDO_CC_MEANV: Cell center is computed as the mean of cell vertices
CS_CDO_CC_BARYC: Cell center is computed as the real cell barycenter
CS_CDO_CC_SATURNE: Cell center is given by Code_Saturne
*/
return CS_CDO_CC_BARYC;
}
/*----------------------------------------------------------------------------*/
/*!
* \brief Setup advanced features concerning the numerical parameters
* of the equation resolved during the computation
*
* \param[in, out] domain pointer to a cs_domain_t structure
*/
/*----------------------------------------------------------------------------*/
void
cs_user_cdo_numeric_settings(cs_domain_t *domain)
{
return; /* REMOVE_LINE_FOR_USE_OF_SUBROUTINE */
/* Modify the setting of an equation using a generic process
*********** cs_equation_set_param(eq, key, "val") ************
CS_EQKEY_SPACE_SCHEME
"cdo_vb" for CDO vertex-based scheme
"cdo_vcb" for CDO vertex+cell-based scheme
"cdo_fb" for CDO face-based scheme
CS_EQKEY_VERBOSITY
The higher the more detailed information is displayed
"0" (default)
"1" detailed setup resume and coarse grain timer stats
"2" fine grain for timer stats
CS_EQKEY_HODGE_DIFF_ALGO
CS_EQKEY_HODGE_TIME_ALGO
CS_EQKEY_HODGE_REAC_ALGO
"voronoi" (default for time), leads to diagonal discrete Hodge operator
but is not consistent for all meshes
"cost" (default for diffusion) is more robust (i.e. it handles more
general meshes but is is less efficient)
"wbs" (default for reaction) is robust and accurate but is limited to
the reconstruction of potential-like degrees of freedom and needs a correct
computation of the cell barycenter
CS_EQKEY_HODGE_DIFF_COEF
CS_EQKEY_HODGE_TIME_COEF
CS_EQKEY_HODGE_REAC_COEF
This key is only useful if CS_EQKEY_HODGE_*_ALGO is set to "cost"
val is either a name or a value: "dga", "sushi", "gcr" or "1.5", "9"..
"dga" corresponds to the value 1./3.
"sushi" corresponds to the value 1./sqrt(3.)
"gcr" corresponds to the value 1.
CS_EQKEY_SOLVER_FAMILY
>> val: "cs" (default), "petsc"
WARNING: For using "petsc" one needs to install Code_Saturne with PETSc
CS_EQKEY_ITSOL
>> val: "cg" is among the following choices:
"cg" (default) is the standard conjuguate gradient algorithm
"bicg" is Bi-CG algorithm (for non-symmetric linear systems)
"bicgstab2" is BiCG-Stab2 algorithm (for non-symmetric linear systems)
"cr3" is a 3-layer conjugate residual solver
"gmres" is a robust iterative solver but not as efficient
"amg" is an algebraic multigrid iterative solver
CS_EQKEY_PRECOND
>> val is among the following choices:
"jacobi" diagonal preconditoner
"block_jacobi"
"poly1" neumann polynomial of order 1
"ssor" symmetric successive over-relaxation (only with PETSC)
"ilu0" incomplete LU factorization
"icc0" incomplete Cholesky factorization (for symmetric matrices)
"amg" algebraic multigrid
CS_EQKEY_ITSOL_EPS
"1e-10" for instance
CS_EQKEY_ITSOL_MAX_ITER
"2000" for instance
CS_EQKEY_ITSOL_RESNORM
"true" or "false"
CS_EQKEY_ITSOL_VERBOSITY
"0", "1", "2" or higher
CS_EQKEY_BC_ENFORCEMENT
Set the type of enforcement of the boundary conditions
"strong" remove unknowns attached to a BC
"penalization" weak enforcement using a huge penalization coefficient
"weak" weak enforcement using the Nitsche method
"weak_sym" weak enforcement keeping the symmetry of the system
CS_EQKEY_BC_QUADRATURE
Set the quadrature algorithm used for evaluating boundary conditions
"subdiv" used a subdivision into tetrahedra
"bary" used the barycenter approximation
"higher" used 4 Gauss points for approximating the integral
"highest" used 5 Gauss points for approximating the integral
Remark: "higher" and "highest" implies automatically a subdivision into
tetrahedra of each cell
CS_EQKEY_TIME_SCHEME
"implicit": first-order in time (inconditionnally stable)
"explicit":
"crank_nicolson": second_order in time
"theta_scheme": generic time scheme. One recovers "implicit" with theta
equal to "1", "explicit" with "0", "crank_nicolson" with "0.5"
CS_EQKEY_TIME_THETA
Only useful if CS_EQKEY_TIME_SCHEME is set to "theta_scheme"
>> val: "0.75" for instance (must be between 0 <=val<= 1)
CS_EQKEY_ADV_FORMULATION
"conservative"
"non_conservative"
CS_EQKEY_ADV_SCHEME
"upwind"
"centered"
"samarskii": upwind/centered with a weight depending on the Peclet number
"sg": upwind/centered with a weight depending on the Peclet number
CS_EQKEY_ADV_FLUX_QUADRA (see CS_EQKEY_BC_QUADRATURE)
"bary" (default)
"higher"
"highest"
CS_EQKEY_EXTRA_OP: Additional post-processing options:
"peclet" to post-process an estimation of the Peclet number in each cell
"upwind_coef" to post-process an estimation of the upwinding coefficient
*/
cs_equation_t *eq = cs_domain_get_equation(domain, "FVCA6.1");
cs_equation_set_param(eq, CS_EQKEY_SPACE_SCHEME, "cdo_vb");
cs_equation_set_param(eq, CS_EQKEY_VERBOSITY, "2");
cs_equation_set_param(eq, CS_EQKEY_HODGE_DIFF_ALGO, "cost");
cs_equation_set_param(eq, CS_EQKEY_HODGE_DIFF_COEF, "dga");
cs_equation_set_param(eq, CS_EQKEY_SOLVER_FAMILY, "petsc");
cs_equation_set_param(eq, CS_EQKEY_PRECOND, "amg");
cs_equation_set_param(eq, CS_EQKEY_ITSOL, "cg");
cs_equation_set_param(eq, CS_EQKEY_ITSOL_MAX_ITER, "2500");
cs_equation_set_param(eq, CS_EQKEY_ITSOL_EPS, "1e-12");
cs_equation_set_param(eq, CS_EQKEY_ITSOL_RESNORM, "false");
cs_equation_set_param(eq, CS_EQKEY_ITSOL_VERBOSITY, "1");
}
|