Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enthalpy correction fix #68

Merged
merged 4 commits into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions FEM/fem_ele_std_tes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,16 +689,19 @@ double CFiniteElementStd::CalCoef_RHS_TES(const int dof_index)
// AB + \Delta H <--> A + B
H_vap = - SolidProp->reaction_enthalpy;
//enthalpy correction
const double rhoSR = gp_ele->rho_s_curr[gp];
const double dcp_drhoSR((((*SolidProp->data_Capacity)(1)*SolidProp->upper_solid_density_limit -
(*SolidProp->data_Capacity)(0)*SolidProp->lower_solid_density_limit)/
(SolidProp->upper_solid_density_limit-SolidProp->lower_solid_density_limit) -
(*SolidProp->data_Capacity)(0)) * SolidProp->lower_solid_density_limit/(rhoSR*rhoSR));

const double cpS = SolidProp->Heat_Capacity(rhoSR);
const double cpG = FluidProp->SpecificHeatCapacity(eos_arg);
H_vap -= (cpS - cpG + rhoSR * dcp_drhoSR)*(Tg - 573.15);//TODO: Move IC to input file

if (SolidProp->Capacity_mode == 4 || SolidProp->Capacity_mode == 5)
{
const double rhoSR = gp_ele->rho_s_curr[gp];
const double dcp_drhoSR(
(((*SolidProp->data_Capacity)(1) * SolidProp->upper_solid_density_limit
- (*SolidProp->data_Capacity)(0) * SolidProp->lower_solid_density_limit)
/ (SolidProp->upper_solid_density_limit - SolidProp->lower_solid_density_limit)
- (*SolidProp->data_Capacity)(0)) * SolidProp->lower_solid_density_limit / (rhoSR * rhoSR));

const double cpS = SolidProp->Heat_Capacity(rhoSR);
const double cpG = FluidProp->SpecificHeatCapacity(eos_arg);
H_vap -= (cpS - cpG + rhoSR * dcp_drhoSR) * (Tg - SolidProp->T_ref_enthalpy_correction);
}
}
val += (1.0-poro) * q_r * H_vap;
val += gp_ele->rho_s_curr[gp] * (1.0-poro) * SolidProp->specific_heat_source;
Expand Down
23 changes: 14 additions & 9 deletions FEM/fem_ele_std_tneq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,16 +743,21 @@ double CFiniteElementStd::CalCoef_RHS_TNEQ(const int dof_index)
Xw = ipol(X0, X1, theta, this);
// end of adding eos_arg-----------------
double H_vap = - SolidProp->reaction_enthalpy; //sign convention: defined negative for exothermic composition reaction but equ. written as: AB + \Delta H <--> A + B

//Correction for temperature-dependent enthalpy in case of variable cpS
const double rhoSR = gp_ele->rho_s_curr[gp];
const double dcp_drhoSR((((*SolidProp->data_Capacity)(1)*SolidProp->upper_solid_density_limit -
(*SolidProp->data_Capacity)(0)*SolidProp->lower_solid_density_limit)/
(SolidProp->upper_solid_density_limit-SolidProp->lower_solid_density_limit) -
(*SolidProp->data_Capacity)(0)) * SolidProp->lower_solid_density_limit/(rhoSR*rhoSR));

const double cpS = SolidProp->Heat_Capacity(rhoSR);
const double cpG = FluidProp->SpecificHeatCapacity(eos_arg);
H_vap -= (cpS - cpG + rhoSR * dcp_drhoSR)*(Ts - 573.15);//TODO: Move IC to input file
if (SolidProp->Capacity_mode == 4 || SolidProp->Capacity_mode == 5)
{
const double rhoSR = gp_ele->rho_s_curr[gp];
const double dcp_drhoSR(
(((*SolidProp->data_Capacity)(1) * SolidProp->upper_solid_density_limit
- (*SolidProp->data_Capacity)(0) * SolidProp->lower_solid_density_limit)
/ (SolidProp->upper_solid_density_limit - SolidProp->lower_solid_density_limit)
- (*SolidProp->data_Capacity)(0)) * SolidProp->lower_solid_density_limit / (rhoSR * rhoSR));

const double cpS = SolidProp->Heat_Capacity(rhoSR);
const double cpG = FluidProp->SpecificHeatCapacity(eos_arg);
H_vap -= (cpS - cpG + rhoSR * dcp_drhoSR) * (Ts - SolidProp->T_ref_enthalpy_correction);
}

val = (1.0 - poro) * q_r * H_vap;
val += gp_ele->rho_s_curr[gp] * (1.0 - poro) * SolidProp->specific_heat_source;
Expand Down
12 changes: 11 additions & 1 deletion FEM/rf_msp_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,12 @@ std::ios::pos_type CSolidProperties::Read(std::ifstream* msp_file)
in_sd >> specific_heat_source;
in_sd.clear();
}
if (line_string.find("$ENTHALPY_CORRECTION_REFERENCE_TEMPERATURE") != string::npos)
{
in_sd.str(GetLineFromFile1(msp_file));
in_sd >> T_ref_enthalpy_correction;
in_sd.clear();
}

if (line_string.find("$MICRO_STRUCTURE_PLAS") != string::npos) // WX:09.2011 for anisotropic plasticity
{
Expand Down Expand Up @@ -892,6 +898,8 @@ void CSolidProperties::SetSolidReactiveSystemProperties() // Definition auch in
reaction_enthalpy = -1.083e+05/PhysicalConstant::MolarMass::Water; //in J/kg (Molar heat of reaction divided by molar mass of water)
//negative for exothermic composition reaction
reaction_entropy = -143.5/PhysicalConstant::MolarMass::Water; //in J/kgK
std::cout << "Set enthalpy correction reference temperature with keyword "
"$ENTHALPY_CORRECTION_REFERENCE_TEMPERATURE; usually to initial solid temperature." << std::endl;
}
else if (reaction_system.compare("Mn3O4") == 0)
{
Expand All @@ -900,6 +908,8 @@ void CSolidProperties::SetSolidReactiveSystemProperties() // Definition auch in
reaction_enthalpy = -1.376e+05 / 0.032; // in J/kg (Molar heat of reaction divided by molar mass of oxygen)
// negative for exothermic composition reaction
reaction_entropy = -114.1 / 0.032; // in J/kgK
std::cout << "Set enthalpy correction reference temperature with keyword "
"$ENTHALPY_CORRECTION_REFERENCE_TEMPERATURE; usuall to initial solid temperature." << std::endl;
}
else if (reaction_system.compare("Z13XBF") == 0)
{
Expand Down Expand Up @@ -1015,7 +1025,7 @@ CSolidProperties::CSolidProperties()
reaction_entropy = 0.0;
non_reactive_solid_volume_fraction = 0.0;
non_reactive_solid_density = 0.0;

T_ref_enthalpy_correction = 573.15;
specific_heat_source = 0.0;

bishop_model = -1; // 15.08.2011. WW
Expand Down
2 changes: 1 addition & 1 deletion FEM/rf_msp_new.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class CSolidProperties
double reaction_entropy;
double non_reactive_solid_volume_fraction;
double non_reactive_solid_density;

double T_ref_enthalpy_correction;
double specific_heat_source;

// CMCD
Expand Down