4#ifndef lethe_specific_heat_model_h
5#define lethe_specific_heat_model_h
31 static std::shared_ptr<SpecificHeatModel>
63 value(
const std::map<field, double> &field_values)
override
82 std::vector<double> &property_vector)
override
135 std::vector<double> &jacobian_vector)
override
139 std::ranges::fill(jacobian_vector, 0);
180 :
param(p_phase_change_parameters)
197 value(
const std::map<field, double> &field_values)
override
200 PhysicialPropertyModelFieldUndefined(
"PhaseChangeSpecificHeat",
203 PhysicialPropertyModelFieldUndefined(
"PhaseChangeSpecificHeat",
206 PhysicialPropertyModelFieldUndefined(
"PhaseChangeSpecificHeat",
221 const Vector<double> &bdf_coefs =
237 bdf_coefs[0] * enthalpy_current + bdf_coefs[1] * enthalpy_p1;
254 const double dH = bdf_coefs[0] * enthalpy_current +
255 bdf_coefs[1] * enthalpy_p1 +
256 bdf_coefs[2] * enthalpy_p2;
264 throw(std::runtime_error(
265 "Other time integration schemes are not supported by the phase change model"));
280 std::vector<double> &property_vector)
override
283 PhysicialPropertyModelFieldUndefined(
"PhaseChangeSpecificHeat",
286 PhysicialPropertyModelFieldUndefined(
"PhaseChangeSpecificHeat",
289 PhysicialPropertyModelFieldUndefined(
"PhaseChangeSpecificHeat",
291 const std::vector<double> &temperature_vec =
293 const std::vector<double> &p1_temperature_vec =
295 const std::vector<double> &p2_temperature_vec =
298 const unsigned int n_values = temperature_vec.size();
300 Assert(n_values == p2_temperature_vec.size(),
301 SizeOfFields(n_values, p2_temperature_vec.size()));
302 Assert(n_values == p1_temperature_vec.size(),
303 SizeOfFields(n_values, p1_temperature_vec.size()));
304 Assert(n_values == property_vector.size(),
305 SizeOfFields(n_values, property_vector.size()));
311 std::vector<double> time_steps_vector =
315 const Vector<double> &bdf_coefs =
318 for (
unsigned int i = 0; i < n_values; ++i)
337 bdf_coefs[0] * enthalpy_current + bdf_coefs[1] * enthalpy_p1;
343 property_vector[i] = dH / dT;
359 const double dH = bdf_coefs[0] * enthalpy_current +
360 bdf_coefs[1] * enthalpy_p1 +
361 bdf_coefs[2] * enthalpy_p2;
365 property_vector[i] = dH / (dT + 1e-8);
370 throw(std::runtime_error(
371 "Other time integration schemes are not supported by the phase change model"));
395 PhysicialPropertyModelFieldUndefined(
396 "EvaporationModelTemperature",
"temperature"));
419 std::vector<double> &jacobian_vector)
override
422 PhysicialPropertyModelFieldUndefined(
"EvaporationModelTemperature",
456 if (T >
param.T_liquidus)
461 else if (T >
param.T_solidus)
469 return param.cp_s * T;
void vector_value(const std::map< field, std::vector< double > > &field_vectors, std::vector< double > &property_vector) override
vector_value Compute specific heat values.
const double specific_heat
double value(const std::map< field, double > &field_values) override
Compute specific heat value.
double jacobian(const std::map< field, double > &field_values, field id) override
Compute the jacobian (the partial derivative) of the specific heat with respect to a specified field.
ConstantSpecificHeat(const double p_specific_heat)
Constructor of the constant specific heat model.
void vector_jacobian(const std::map< field, std::vector< double > > &field_vectors, const field id, std::vector< double > &jacobian_vector) override
Computes the derivative of the specific heat with respect to specified fields.
Material - Class that defines the physical property of a material. Generally a material will be a flu...
void vector_value(const std::map< field, std::vector< double > > &field_vectors, std::vector< double > &property_vector) override
Compute a vector of specific heat values for an isothermal ideal gas.
PhaseChangeSpecificHeat(const Parameters::PhaseChange p_phase_change_parameters)
Constructor of the phase change specific heat model.
double enthalpy(const double T)
Compute the enthalpy of a phase change material for a temperature .
void vector_jacobian(const std::map< field, std::vector< double > > &field_vectors, const field id, std::vector< double > &jacobian_vector) override
Compute the derivative of the specific heat with respect to a field for an isothermal ideal gas.
const Parameters::PhaseChange param
double jacobian(const std::map< field, double > &field_values, field id) override
Compute the jacobian (the partial derivative) of the specific heat with respect to a specified field.
double value(const std::map< field, double > &field_values) override
Compute the specific heat of the isothermal ideal gas.
std::shared_ptr< SimulationControl > simulation_control
std::shared_ptr< SimulationControl > & get_simulation_control()
void vector_numerical_jacobian(const std::map< field, std::vector< double > > &field_vectors, const field id, std::vector< double > &jacobian_vector)
vector_numerical_jacobian Calculates the vector of jacobian through forward finite difference (Euler)...
double numerical_jacobian(const std::map< field, double > &field_values, const field id)
numerical_jacobian Calculates the jacobian through a forward finite difference (Euler) approximation....
PhysicalPropertyModel()
Default constructor. Set the model_depends_on to false for all variables.
std::map< field, bool > model_depends_on
Abstract class for calculating the specific heat of materials on quadrature points using the temperat...
static std::shared_ptr< SpecificHeatModel > model_cast(const Parameters::Material &material_properties)
Instantiates and returns a pointer to a SpecificHeatModel object by casting it to the proper child cl...
@ temperature
Temperature scalar field from heat transfer.
double calculate_liquid_fraction(const double &T, const Parameters::PhaseChange &phase_change_parameters)
calculate_liquid_fraction Calculates the liquid fraction of a phase change material at a temperature ...
Phase change model for melting/freezing liquids The model assumes that the phase change occurs betwee...