Reply To: Definition of liquid fraction in example galliumMelting2d
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Definition of liquid fraction in example galliumMelting2d › Reply To: Definition of liquid fraction in example galliumMelting2d
Dear Qiong,
The liquid fraction is indeed computed from the Enthalpy as you said.
If you go to the file advectionDiffusionDynamics.h, you will find the function the computed the liquid fraction:
template<typename V, typename PARAMETERS, typename ENTHALPY>
V computeLiquidFraction(const PARAMETERS& parameters, const ENTHALPY& enthalpy) const
{
using namespace TotalEnthalpy;
const V cp_s = parameters.template get<CP_S>();
const V cp_l = parameters.template get<CP_L>();
const V T_s = parameters.template get<T_S>();
const V T_l = parameters.template get<T_L>();
const V l = parameters.template get<L>();
const V H_s = cp_s * T_s;
const V H_l = cp_l * T_l + l;
V liquid_fraction{};
if (enthalpy <= H_s) {
liquid_fraction = 0.;
}
else if (enthalpy >= H_l) {
liquid_fraction = 1.;
}
else {
liquid_fraction = (enthalpy – H_s) / l;
}
return liquid_fraction;
}
Then, if you go to the file navierStokesAdvectionDiffusionCouplingPostProcessor2D.hh,
you will see that the value of the liquid fraction is stored inside the field POROSITY:
cell.template setField<descriptors::POROSITY>(
dynamics->template computeLiquidFraction<T>(parameters, enthalpy));
The POROSITY here is just a variable used to store the information of the liquid fraction, but this one is still computed from the enthalpy.