Skip to content

Commit

Permalink
[Mat] Added a default temperature to fluid properties
Browse files Browse the repository at this point in the history
  • Loading branch information
wenqing committed Jul 24, 2019
1 parent 63a8752 commit d3f32df
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
33 changes: 18 additions & 15 deletions FEM/fem_ele_std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#include "mathlib.h"
// Problems
//#include "rf_mfp_new.h"
#include "SparseMatrixDOK.h"
#include "eos.h"
#include "rf_mmp_new.h"
#include "rf_msp_new.h"
#include "eos.h"
#include "SparseMatrixDOK.h"

#include "pcs_dm.h" // displacement coupled
#include "rfmat_cp.h"
Expand Down Expand Up @@ -61,8 +61,8 @@ using Math_Group::CSparseMatrix;
extern "C"
{
#include <cvode/cvode.h> /* prototypes for CVODE fcts., consts. */
#include <nvector/nvector_serial.h> /* serial N_Vector types, fcts., macros */
#include <cvode/cvode_dense.h> /* prototype for CVDense */
#include <nvector/nvector_serial.h> /* serial N_Vector types, fcts., macros */
#include <sundials/sundials_dense.h> /* definitions DlsMat DENSE_ELEM */
#include <sundials/sundials_types.h> /* definition of type realtype */
}
Expand Down Expand Up @@ -1584,6 +1584,10 @@ double CFiniteElementStd::CalCoefMass()
double arg[2];
arg[0] = interpolate(NodalVal1); // p
arg[1] = interpolate(NodalValC1); // T
if (cpl_pcs)
arg[1] = interpolate(NodalValC1);
else
arg[1] = PhysicalConstant::CelsiusZeroInKelvin + 20.0;
drho_dp_rho = FluidProp->drhodP(arg) / rho_val;
}
else
Expand Down Expand Up @@ -1732,7 +1736,10 @@ double CFiniteElementStd::CalCoefMass()
{ // drho_dp from rho-p-T relation
double arg[2];
arg[0] = PG;
arg[1] = interpolate(NodalValC1); // T
if (cpl_pcs)
arg[1] = interpolate(NodalValC1);
else
arg[1] = PhysicalConstant::CelsiusZeroInKelvin + 20.0;
drho_dp_rho = FluidProp->drhodP(arg) / rhow;
}
else
Expand Down Expand Up @@ -2268,7 +2275,7 @@ void CFiniteElementStd::CalCoefLaplace(bool Gravity, int ip)
if (T_Flag)
variables[1] = interpolate(NodalValC); // OK4709 temperature
else
variables[1] = 15; // WX
variables[1] = PhysicalConstant::CelsiusZeroInKelvin + 20.0;

// OK4709
mat_fac = FluidProp->Viscosity(variables);
Expand Down Expand Up @@ -2628,7 +2635,7 @@ void CFiniteElementStd::CalCoefLaplace(bool Gravity, int ip)
if (cpl_pcs)
TG = interpolate(NodalValC1);
else
TG = 296.0;
TG = PhysicalConstant::CelsiusZeroInKelvin + 20.0;
MediaProp->CalStressPermeabilityFactor(w, TG);
for (size_t i = 0; i < dim; i++)
tensor[i * dim + i] *= w[i];
Expand Down Expand Up @@ -6479,9 +6486,8 @@ void CFiniteElementStd::CalcSolidDensityRate()
const double rhoTil = 0.1;
const double omega = 2.0 * 3.1416;
gp_ele->rho_s_curr[gp] =
rhoSR0 +
rhoTil * sin(omega * aktuelle_zeit) /
(1.0 - poro); // TN Test mass transfer
rhoSR0 + rhoTil * sin(omega * aktuelle_zeit) /
(1.0 - poro); // TN Test mass transfer
gp_ele->q_R[gp] = rhoTil * omega * cos(omega * aktuelle_zeit) /
(1.0 - poro); // TN Test mass transfer
}
Expand Down Expand Up @@ -9014,9 +9020,7 @@ void CFiniteElementStd::Assemble_strainCPL(const int phase)
*/
//**************************************************************************
#if defined(USE_PETSC) // && !defined(other parallel libs)//03~04.3012. WW
void CFiniteElementStd::Assemble_strainCPL_Matrix(const double, const int)
{
}
void CFiniteElementStd::Assemble_strainCPL_Matrix(const double, const int) {}
#else
void CFiniteElementStd::Assemble_strainCPL_Matrix(const double fac,
const int phase)
Expand Down Expand Up @@ -11955,9 +11959,8 @@ void CFiniteElementStd::CalcEnergyNorm(double& err_norm0, double& err_normn)
for (i = 0; i < nnodes; i++)
{
#if defined(USE_PETSC) // || defined(other parallel libs)//07.3012. WW
NodalVal0[i] = atol +
rtol * max(fabs(pcs->GetNodeValue(nodes[i], idx)),
fabs(x_n[nodes[i] * dof_n]));
NodalVal0[i] = atol + rtol * max(fabs(pcs->GetNodeValue(nodes[i], idx)),
fabs(x_n[nodes[i] * dof_n]));
#else
NodalVal0[i] =
atol + rtol * max(fabs(pcs->GetNodeValue(nodes[i], idx)),
Expand Down
16 changes: 14 additions & 2 deletions FEM/rf_mfp_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ extern double GetCurveValue(int, int, double, int*);
#include "rf_REACT_GEM.h"
#endif

#include "PhysicalConstant.h"
#include "Material/Fluid/Density/WaterDensityIAPWSIF97Region1.h"
#include "PhysicalConstant.h"

/* Umrechnungen SI - Amerikanisches System */
// WW #include "steam67.h"
Expand Down Expand Up @@ -1053,7 +1053,19 @@ void CFluidProperties::CalPrimaryVariable(
// MX m_pcs = PCSGet("HEAT_TRANSPORT");
m_pcs = PCSGet(pcs_name_vector[i], true);
if (!m_pcs)
return; // MX
{
if (pcs_name_vector[i].find("TEMPERATURE1") != std::string::npos)
{
const double T_ref =
PhysicalConstant::CelsiusZeroInKelvin + 20.0;
primary_variable_t0[i] = T_ref;
primary_variable_t1[i] = T_ref;
primary_variable[i] = T_ref;
continue;
}
else
return;
}
nidx0 = m_pcs->GetNodeValueIndex(pcs_name_vector[i]);
nidx1 = nidx0 + 1;

Expand Down

0 comments on commit d3f32df

Please sign in to comment.