Skip to content

Commit

Permalink
#151 Added thermal diffusivity coefficient to change values spatially
Browse files Browse the repository at this point in the history
  • Loading branch information
pou036 committed Jan 11, 2018
1 parent b5fab4c commit f6d74b1
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 9 deletions.
2 changes: 2 additions & 0 deletions include/kernels/RedbackThermalDiffusion.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class RedbackThermalDiffusion : public Kernel
virtual Real computeQpResidual();
virtual Real computeQpJacobian();

const MaterialProperty<Real> & _diffusivity;

private:
Real _time_factor;
};
Expand Down
3 changes: 2 additions & 1 deletion include/materials/RedbackMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class RedbackMaterial : public Material
Real _ar_F_param, _ar_R_param, _chemical_ar_F_factor, _da_endo_param, _da_exo_param, _mu_param, _Kc_param,
_eta1_param, _eta2_param, _Aphi_param, _pressurization_coefficient_param;
Real _solid_compressibility_param, _fluid_compressibility_param, _solid_thermal_expansion_param,
_fluid_thermal_expansion_param, _solid_density_param, _fluid_density_param;
_fluid_thermal_expansion_param, _thermal_diffusivity_param, _solid_density_param, _fluid_density_param;
bool _is_mechanics_on, _is_chemistry_on, _are_convective_terms_on;

RealVectorValue _gravity_param;
Expand Down Expand Up @@ -138,6 +138,7 @@ class RedbackMaterial : public Material
MaterialProperty<Real> & _fluid_compressibility; // \bar(\beta_f)/\sigma_{ref}
MaterialProperty<Real> & _solid_thermal_expansion; // \bar(\lambda_s)/ \delta T_ref
MaterialProperty<Real> & _fluid_thermal_expansion; // \bar(\lambda_f)/delta T_ref
MaterialProperty<Real> & _thermal_diffusivity;

MaterialProperty<Real> & _mixture_density;

Expand Down
8 changes: 5 additions & 3 deletions src/kernels/RedbackThermalDiffusion.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ validParams<RedbackThermalDiffusion>()
}

RedbackThermalDiffusion::RedbackThermalDiffusion(const InputParameters & parameters) :
Kernel(parameters), _time_factor(getParam<Real>("time_factor"))
Kernel(parameters),
_diffusivity(getMaterialProperty<Real>("thermal_diffusivity")),
_time_factor(getParam<Real>("time_factor"))
{
}

Expand All @@ -35,11 +37,11 @@ RedbackThermalDiffusion::~RedbackThermalDiffusion()
Real
RedbackThermalDiffusion::computeQpResidual()
{
return _time_factor * _grad_u[ _qp ] * _grad_test[ _i ][ _qp ];
return _time_factor * _diffusivity[ _qp ] * _grad_u[ _qp ] * _grad_test[ _i ][ _qp ];
}

Real
RedbackThermalDiffusion::computeQpJacobian()
{
return _time_factor * _grad_phi[ _j ][ _qp ] * _grad_test[ _i ][ _qp ];
return _time_factor * _diffusivity[ _qp ] * _grad_phi[ _j ][ _qp ] * _grad_test[ _i ][ _qp ];
}
4 changes: 4 additions & 0 deletions src/materials/RedbackMaterial.C
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ validParams<RedbackMaterial>()
params.addParam<Real>("fluid_thermal_expansion",
0,
"fluid expansion (lambda^{(f)} in 1/K)"); // _fluid_thermal_expansion_param
params.addParam<Real>("thermal_diffusivity", 1, "normalised thermal diffusivity (-)"); // _thermal_diffusivity_param
params.addParam<Real>("solid_density", 2.5, "normalised solid density (-)"); // solid_density_param
params.addParam<Real>("fluid_density", 1, "normalised fluid density (-)"); // fluid_density_param

Expand Down Expand Up @@ -164,6 +165,7 @@ RedbackMaterial::RedbackMaterial(const InputParameters & parameters) :
_fluid_compressibility_param(getParam<Real>("fluid_compressibility")),
_solid_thermal_expansion_param(getParam<Real>("solid_thermal_expansion")),
_fluid_thermal_expansion_param(getParam<Real>("fluid_thermal_expansion")),
_thermal_diffusivity_param(getParam<Real>("thermal_diffusivity")),
_solid_density_param(getParam<Real>("solid_density")),
_fluid_density_param(getParam<Real>("fluid_density")),

Expand Down Expand Up @@ -224,6 +226,7 @@ RedbackMaterial::RedbackMaterial(const InputParameters & parameters) :
_fluid_compressibility(declareProperty<Real>("fluid_compressibility")),
_solid_thermal_expansion(declareProperty<Real>("solid_thermal_expansion")),
_fluid_thermal_expansion(declareProperty<Real>("fluid_thermal_expansion")),
_thermal_diffusivity(declareProperty<Real>("thermal_diffusivity")),

_mixture_density(declareProperty<Real>("mixture_density")),

Expand Down Expand Up @@ -399,6 +402,7 @@ RedbackMaterial::stepInitQpProperties()
_fluid_compressibility[ _qp ] = _fluid_compressibility_param;
_solid_thermal_expansion[ _qp ] = _solid_thermal_expansion_param;
_fluid_thermal_expansion[ _qp ] = _fluid_thermal_expansion_param;
_thermal_diffusivity[ _qp ] = _thermal_diffusivity_param;
_mixture_density[ _qp ] = (1 - _phi0_param) * _solid_density_param + _phi0_param * _fluid_density_param;
_mixture_gravity_term[ _qp ] = _mixture_density[ _qp ] * _gravity_param;
_fluid_gravity_term[ _qp ] = _fluid_density_param * _gravity_param;
Expand Down
3 changes: 1 addition & 2 deletions tests/benchmark_1_T/bench1_a.i
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
variable = temp
[../]
[./diff_temp]
type = Diffusion
type = RedbackThermalDiffusion
variable = temp
[../]
[./mh_temp]
Expand Down Expand Up @@ -150,4 +150,3 @@
block = 0
[../]
[]

2 changes: 1 addition & 1 deletion tests/benchmark_1_T/bench1_b.i
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
variable = temp
[../]
[./diff_temp]
type = Diffusion
type = RedbackThermalDiffusion
variable = temp
[../]
[./mh_temp]
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmark_1_T/bench1_c.i
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
variable = temp
[../]
[./diff_temp]
type = Diffusion
type = RedbackThermalDiffusion
variable = temp
[../]
[./mh_temp]
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmark_1_T/bench1_d.i
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
variable = temp
[../]
[./diff_temp]
type = Diffusion
type = RedbackThermalDiffusion
variable = temp
[../]
[./mh_temp]
Expand Down
177 changes: 177 additions & 0 deletions tests/benchmark_1_T/diffusion_2_zones.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 5
nz = 5
xmin = -1
[]

[Variables]
inactive = 'disp_x disp_y'
[./temp]
[../]
[./disp_x]
order = CONSTANT
family = MONOMIAL
block = '0'
[../]
[./disp_y]
order = CONSTANT
family = MONOMIAL
block = '0'
[../]
[]

[AuxVariables]
[./total_porosity]
order = FIRST
family = MONOMIAL
[../]
[]

[Kernels]
[./td_temp]
type = TimeDerivative
variable = temp
[../]
[./diff_temp]
type = RedbackThermalDiffusion
variable = temp
[../]
[]

[AuxKernels]
[./total_porosity]
type = RedbackTotalPorosityAux
variable = total_porosity
[../]
[]

[BCs]
inactive = 'disp_y disp_x_left disp_x_rigth'
[./left_temp]
type = DirichletBC
variable = temp
boundary = 'left'
value = 1
[../]
[./right_temp]
type = DirichletBC
variable = temp
boundary = 'right'
value = 0
[../]
[./disp_y]
type = DirichletBC
variable = disp_y
boundary = 'left right'
value = 0
[../]
[./disp_x_left]
type = DirichletBC
variable = disp_x
boundary = 'left'
value = 1
[../]
[./disp_x_rigth]
type = DirichletBC
variable = disp_x
boundary = 'right'
value = 0
[../]
[]

[Materials]
[./zone0]
type = RedbackMaterial
block = '0'
alpha_2 = 1
ar = 10
gr = 4.313e-6 # 0.095*exp(-Ar), Ar=10
pore_pres = '0'
temperature = 'temp'
ref_lewis_nb = 1
ar_F = 40
ar_R = 1
Aphi = 0
phi0 = 0.1
da_endo = 1
total_porosity = 'total_porosity'
[../]
[./1]
type = RedbackMaterial
gr = 4.313e-6
thermal_diffusivity = 2
ar = 10
alpha_2 = 1
da_endo = 1
pore_pres = '0'
total_porosity = 'total_porosity'
ref_lewis_nb = 1
Aphi = 0
ar_F = 40
phi0 = 0.1
ar_R = 1
temperature = 'temp'
block = '1'
[../]
[]

[Postprocessors]
inactive = 'strain'
[./middle_temp]
type = PointValue
variable = temp
point = '0 0 0'
[../]
[./strain]
type = StrainRatePoint
variable = 'temp'
point = '0 0 0'
[../]
[]

[Executioner]
type = Transient
num_steps = 10000
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
ss_check_tol = 1e-6
end_time = 0.1
dtmax = 0.1
scheme = bdf2
dt = 0.01
inactive = 'TimeStepper'
[./TimeStepper]
type = ConstantDT
dt = 0.1
[../]
[]

[Outputs]
file_base = diffusion_2_zones
exodus = true
csv = true
execute_on = 'TIMESTEP_END INITIAL'
console = true
[]

[ICs]
[./temp_ic]
type = ConstantIC
variable = temp
value = 0
block = '0'
[../]
[]

[MeshModifiers]
[./subdomain]
type = SubdomainBoundingBox
block_id = 1
top_right = '1 0.5 1'
bottom_left = '-1 0 0'
[../]
[]

12 changes: 12 additions & 0 deletions tests/benchmark_1_T/gold/diffusion_2_zones.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
time,middle_temp
0,0
0.01,0.0003517680707738
0.02,0.0013221992503743
0.03,0.003993185763101
0.04,0.0097457882306281
0.05,0.019393931728029
0.06,0.0325542772602
0.07,0.048025161209583
0.08,0.064568238223777
0.09,0.081314686656574
0.1,0.097780937173092
5 changes: 5 additions & 0 deletions tests/benchmark_1_T/tests
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@
input = 'bench1_d.i'
csvdiff = 'bench1_d_out.csv'
[../]
[./test_diffusion_2_zones] # can't put a dot in that name!
type = 'CSVDiff'
input = 'diffusion_2_zones.i'
csvdiff = 'diffusion_2_zones.csv'
[../]
[]

0 comments on commit f6d74b1

Please sign in to comment.