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);
}
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:
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);
}
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.
{
int n_iter_max = 20;
double rel_tolerance = 1e-3;
}
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);
}
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;
}
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".
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).
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: