The solidification module relies on CDO face-based schemes.
To set-up a computation taking into account the solidification process, one has to update the cs_user_parameters.c file and edit the function cs_user_model and cs_user_finalize_setup at least in simple cases. In more complex cases, editing the function cs_user_parameters and defining functions to describe the boundary condition or the material properties should be necessary.
Activate the solidification module
The first step is to activate the CDO module in the function cs_user_model (please refer to Activation of CDO/HHO schemes).
When CDO is activated, one can activate the solidification module using cs_solidification_activate. There are eight parameters to set :
- The type of solidification model to consider. This implies which equations are to be solved and which variables are involved. Choices are detailed in cs_solidification_model_t ;
- An optional flag to specify advanced user-defined options (set 0 if nothing has to be added);
- An optional flag to specify automatic post-processing dedicated to this module (set 0 if nothing has to be added);
- The domain boundaries (see cs_boundary_t for more details);
- The Navier-Stokes model (see cs_navsto_param_model_t for more details). The default choice should be CS_NAVSTO_MODEL_INCOMPRESSIBLE_NAVIER_STOKES but a Stokes model (set CS_NAVSTO_MODEL_STOKES) is also possible if the advection term can be neglected.
- Additional user-defined options for the Navier-Stokes model (by default the Boussinesq approximation is set even if 0 is given as parameter). The recommended value for this parameter is 0.
- The algorithm used to couple velocity and pressure fields. Available choices are detailed in cs_navsto_param_coupling_t
- An optional flag to specify automatic post-processing for the Navier-Stokes module. Available options are detailed in cs_navsto_param_post_bit_t).
{
solid_option_flag,
solid_post_flag,
domain->boundaries,
navsto_model_flag,
navsto_post_flag);
}
unsigned short int cs_flag_t
Definition: cs_defs.h:321
@ CS_NAVSTO_COUPLING_MONOLITHIC
Definition: cs_navsto_param.h:580
@ CS_NAVSTO_MODEL_INCOMPRESSIBLE_NAVIER_STOKES
Definition: cs_navsto_param.h:86
@ CS_NAVSTO_POST_MASS_DENSITY
Definition: cs_navsto_param.h:197
@ CS_NAVSTO_POST_VELOCITY_DIVERGENCE
Definition: cs_navsto_param.h:190
cs_solidification_t * cs_solidification_activate(cs_solidification_model_t model, cs_flag_t options, cs_flag_t post_flag, const cs_boundary_t *boundaries, cs_navsto_param_model_t ns_model, cs_navsto_param_model_flag_t ns_model_flag, cs_navsto_param_coupling_t algo_coupling, cs_navsto_param_post_flag_t ns_post_flag)
Activate the solidification module.
Definition: cs_solidification.c:3261
@ CS_SOLIDIFICATION_MODEL_BINARY_ALLOY
Definition: cs_solidification.h:200
#define CS_SOLIDIFICATION_POST_SOLIDIFICATION_RATE
Activate the computation and output in the file solidification.dat for each time step of the integral...
Definition: cs_solidification.h:98
Model of solidification and its options
Here are listed the available solidification models (first parameter of the function cs_solidification_activate):
- CS_SOLIDIFICATION_MODEL_STEFAN : a pure thermal model, i.e. without a fluid motion. A rough phase transition is considered (the solidus is equal to the liquidus temperature) ;
- CS_SOLIDIFICATION_MODEL_VOLLER_PRAKASH_87 : a model involving momentum, mass and energy conservation equations. A Boussinesq approximation is used for the Navier–Stokes model. The thermal source term is linearized. A pure component is considered. The solidification process hinges on a head loss described as a Darcy-like source term in the momentum equation (see the Voller and Prakash article for more details).
- CS_SOLIDIFICATION_MODEL_VOLLER_NL : This is the CS_SOLIDIFICATION_MODEL_VOLLER_PRAKASH_87 model with a non-linear thermal source term (a Picard algorithm is used to update the source term).
- CS_SOLIDIFICATION_MODEL_BINARY_ALLOY : This model hinges on the Voller and Prakash model but adds an additional equation for the solute transport. The solute concentration has an effect on the Boussinesq term. The phase diagram is more complex since a binary alloy is considered. One also handles the eutectic transformation according to the solidification path.
Here are listed the available options (second parameter of the function cs_solidification_activate):
Automatic post-processing
Here are listed the available options (third parameter of the function cs_solidification_activate):
The following options make sense only when the CS_SOLIDIFICATION_MODEL_BINARY_ALLOY is activated
Model settings
Set a strategy
Excepted for the Stefan model, it is possible to change the strategy to update quantities such as the way to compute the new thermal source term. There are three strategies available (cs_solidification_strategy_t for more details). The default strategy is CS_SOLIDIFICATION_STRATEGY_LEGACY
Here is an example to set the strategy:
{
}
void cs_solidification_set_strategy(cs_solidification_strategy_t strategy)
Set the strategy to update quantitiess (liquid fraction and the thermal source term for the two main ...
Definition: cs_solidification.c:3995
@ CS_SOLIDIFICATION_STRATEGY_PATH
Definition: cs_solidification.h:247
Stefan model
The Stefan model handles the solidification process with the approximation that the liquidus and solidus temperature are the same. Thus, the transition from the solid to liquid or from the liquid to solid is rough.
Voller and Prakash model
The main function to set a Voller and Prakash model is cs_solidification_set_voller_model (follow the link to get a description of the parameters). This function is mandatory and has to be located in cs_user_model after calling cs_solidification_activate
- Parameters 1 and 2 correspond to the settings of the Boussinesq term (two coefficients related to a reference temperature and a thermal dilation coefficient in
).
- Parameters 3 and 4 are the solidus and liquidus temperature describing the behavior of the liquid fraction with respect to the temperature.
- Parameters 5 and 6 correspond to the latent heat of the alloy (assumed to be constant) and the secondary dendrite arm spacing (a model parameter taking into account micro-segregation phenomena).
{
cs_real_t t_solidus = -0.1, t_liquidus = 0.1;
beta_t,
T0,
t_solidus,
t_liquidus,
latent_heat,
s_das);
t_solidus,
t_liquidus,
latent_heat);
}
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
void cs_solidification_set_voller_model(cs_real_t beta, cs_real_t t_ref, cs_real_t t_solidus, cs_real_t t_liquidus, cs_real_t latent_heat, cs_real_t s_das)
Set the main physical parameters which describe the Voller and Prakash modelling.
Definition: cs_solidification.c:3706
void cs_solidification_set_voller_model_no_velocity(cs_real_t t_solidus, cs_real_t t_liquidus, cs_real_t latent_heat)
Set the main physical parameters which describe the Voller and Prakash modelling.
Definition: cs_solidification.c:3747
Please notice that a simplified version of the function exists in case of purely thermal model (activated when the flag CS_SOLIDIFICATION_NO_VELOCITY_FIELD has been set).
Non-linear Voller and Prakash model
The setting of the non-linear variant of the Voller and Prakash model relies on the main function as the linear one (i.e. cs_solidification_set_voller_model or cs_solidification_set_voller_model_no_velocity in a more specific situation).
Advanced usage
To access more settings, it is possible to retrieve the structure managing the voller model and to specify advanced parameter settings in order to set the non-linear iterative algorithm for instance.
{
}
cs_solidification_voller_t * cs_solidification_get_voller_struct(void)
Get the structure defining the Voller model.
Definition: cs_solidification.c:3645
cs_param_sles_cvg_t cvg_param
Definition: cs_iter_algo.h:116
int n_max_iter
Definition: cs_param_sles.h:81
double rtol
Definition: cs_param_sles.h:79
Definition: cs_solidification.h:326
cs_iter_algo_t * nl_algo
Definition: cs_solidification.h:358
Binary alloy model
The main function to set a binary alloy model is cs_solidification_set_binary_alloy_model (follow the link to get a description of the parameters). This function is mandatory and has to be located in cs_user_model after calling cs_solidification_activate
- Parameters 1 and 2 correspond to the name of the equation related to the solute transport and the name of the unknow associated to this equation (this will be the name of the variable field).
- Parameters 3 to 6 correspond to the settings of the Boussinesq term (two contributions: the classical thermal one given by a reference temperature and a thermal dilation coefficient in
; the solutal contribution to the Boussinesq term given by a reference concentration and a solutal dilation coefficient)
- Parameters 7 to 10 correspond to the main parameters describing the phase diagram (the partition coefficient between solid and liquid phase, the liquidus slope, the eutectic temperature and the melting temperature for a pure material which corresponds to the one obtained when one of the component of the binary alloy is not present).
- Parameter 11 is the value of the diffusivity for the solute transport equation
- Parameters 12 and 13 correspond to the latent heat of the alloy (assumed to be constant) and the secondary dendrite arm spacing (a model parameter taking into account micro-segregation phenomena).
{
"C_bulk",
beta_t,
T0,
beta_c,
conc0,
kp,
ml,
t_eutec,
t_melt,
diff_val,
latent_heat,
s_das);
}
void cs_solidification_set_binary_alloy_model(const char *name, const char *varname, cs_real_t beta_t, cs_real_t temp0, cs_real_t beta_c, cs_real_t conc0, cs_real_t kp, cs_real_t mliq, cs_real_t t_eutec, cs_real_t t_melt, cs_real_t solute_diff, cs_real_t latent_heat, cs_real_t s_das)
Set the main physical parameters which describe a solidification process with a binary alloy (with co...
Definition: cs_solidification.c:3860
Advanced usage
To access more settings, it is possible to retrieve the structure managing the binary alloy model and to specify advanced parameter settings.
{
int n_iter_max = 10;
double delta_eps = 1e-3;
}
cs_solidification_binary_alloy_t * cs_solidification_get_binary_alloy_struct(void)
Get the structure defining the binary alloy model.
Definition: cs_solidification.c:3776
Definition: cs_solidification.h:367
double delta_tolerance
Definition: cs_solidification.h:447
int n_iter_max
Definition: cs_solidification.h:446
Property settings
The creation of all properties used the solidification model is made automatically. The definition is then performed in the function cs_user_finalize_setup
In simple cases, the main properties are constant (uniform and steady-state) and the definition is thus simply done in the example below. Please notice that predefined properties have a macro to store their name. Here are used:
- CS_PROPERTY_MASS_DENSITY for the (volumetric) mass density which corresponds to the property named "mass_density" (this is different from the legacy Finite Volume where "density" is used);
- CS_NAVSTO_LAM_VISCOSITY for the laminar (dynamic) viscosity which corresponds to the property named "laminar_viscosity";
- CS_THERMAL_CP_NAME for the thermal capacity which corresponds to the property named "thermal_capacity";
- CS_THERMAL_LAMBDA_NAME for the thermal conductivity which corresponds to the property named "thermal_conductivity".
{
}
#define CS_NAVSTO_LAM_VISCOSITY
Definition: cs_cdo_turbulence.h:50
@ mu
Definition: cs_field_pointer.h:103
@ cp
Definition: cs_field_pointer.h:100
@ rho
Definition: cs_field_pointer.h:97
@ lambda
Definition: cs_field_pointer.h:106
cs_property_t * cs_property_by_name(const char *name)
Find the related property definition from its name.
Definition: cs_property.c:1087
cs_xdef_t * cs_property_def_iso_by_value(cs_property_t *pty, const char *zname, double val)
Define an isotropic cs_property_t structure by value for entities related to a volume zone.
Definition: cs_property.c:1600
#define CS_PROPERTY_MASS_DENSITY
Definition: cs_property.h:51
#define CS_THERMAL_LAMBDA_NAME
Definition: cs_thermal_system.h:53
#define CS_THERMAL_CP_NAME
Definition: cs_thermal_system.h:52
real(c_double), pointer, save cp0
reference specific heat.
Definition: cstphy.f90:232
real(c_double), pointer, save lambda0
Reference thermal conductivity.
Definition: cstphy.f90:242
Structure associated to the definition of a property relying on the cs_xdef_t structure.
Equation settings
The last step is to set the initial condition and the boundary conditions. By default, all variable fields are set to zero. For the boundary conditions, if nothing is set, then the default boundary condition is applied. For the thermal equation, the default boundary condition is a no flux (i.e. a homogeneous Neumann boundary condition).
{
}
cs_equation_param_t * cs_equation_param_by_name(const char *eqname)
Return the cs_equation_param_t structure associated to a cs_equation_t structure based on the equatio...
Definition: cs_equation.c:570
cs_xdef_t * cs_equation_add_ic_by_value(cs_equation_param_t *eqp, const char *z_name, cs_real_t *val)
Define the initial condition for the unknown related to this equation. This definition applies to a v...
Definition: cs_equation_param.c:2293
cs_xdef_t * cs_equation_add_bc_by_value(cs_equation_param_t *eqp, const cs_param_bc_type_t bc_type, const char *z_name, cs_real_t *values)
Define and initialize a new structure to set a boundary condition related to the given equation struc...
Definition: cs_equation_param.c:2524
@ CS_PARAM_BC_DIRICHLET
Definition: cs_param_types.h:478
#define CS_THERMAL_EQNAME
Definition: cs_thermal_system.h:51
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:192
When a solute transport equation is added (this done automatically when calling the function cs_solidification_set_binary_alloy_model), the default boundary condition for this equation is a no flux condition as well.
Here is an example how to set the initial solute concentration in the domain.
For the Navier-Stokes equation, the default boundary condition is defined when the domain boundaries are defined in the function cs_user_model using the function cs_boundary_set_default There are two possibilities: