From f6d74b18fff0364e911670575828e2c67b9e1387 Mon Sep 17 00:00:00 2001 From: Thomas Poulet Date: Thu, 11 Jan 2018 19:51:32 +0800 Subject: [PATCH] #151 Added thermal diffusivity coefficient to change values spatially --- include/kernels/RedbackThermalDiffusion.h | 2 + include/materials/RedbackMaterial.h | 3 +- src/kernels/RedbackThermalDiffusion.C | 8 +- src/materials/RedbackMaterial.C | 4 + tests/benchmark_1_T/bench1_a.i | 3 +- tests/benchmark_1_T/bench1_b.i | 2 +- tests/benchmark_1_T/bench1_c.i | 2 +- tests/benchmark_1_T/bench1_d.i | 2 +- tests/benchmark_1_T/diffusion_2_zones.i | 177 ++++++++++++++++++ .../benchmark_1_T/gold/diffusion_2_zones.csv | 12 ++ tests/benchmark_1_T/tests | 5 + 11 files changed, 211 insertions(+), 9 deletions(-) create mode 100644 tests/benchmark_1_T/diffusion_2_zones.i create mode 100644 tests/benchmark_1_T/gold/diffusion_2_zones.csv diff --git a/include/kernels/RedbackThermalDiffusion.h b/include/kernels/RedbackThermalDiffusion.h index 3eeb0507..b3d2d715 100644 --- a/include/kernels/RedbackThermalDiffusion.h +++ b/include/kernels/RedbackThermalDiffusion.h @@ -32,6 +32,8 @@ class RedbackThermalDiffusion : public Kernel virtual Real computeQpResidual(); virtual Real computeQpJacobian(); + const MaterialProperty & _diffusivity; + private: Real _time_factor; }; diff --git a/include/materials/RedbackMaterial.h b/include/materials/RedbackMaterial.h index 0fc27f17..1d0cdbc6 100644 --- a/include/materials/RedbackMaterial.h +++ b/include/materials/RedbackMaterial.h @@ -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; @@ -138,6 +138,7 @@ class RedbackMaterial : public Material MaterialProperty & _fluid_compressibility; // \bar(\beta_f)/\sigma_{ref} MaterialProperty & _solid_thermal_expansion; // \bar(\lambda_s)/ \delta T_ref MaterialProperty & _fluid_thermal_expansion; // \bar(\lambda_f)/delta T_ref + MaterialProperty & _thermal_diffusivity; MaterialProperty & _mixture_density; diff --git a/src/kernels/RedbackThermalDiffusion.C b/src/kernels/RedbackThermalDiffusion.C index 24b2e81c..dd166820 100644 --- a/src/kernels/RedbackThermalDiffusion.C +++ b/src/kernels/RedbackThermalDiffusion.C @@ -24,7 +24,9 @@ validParams() } RedbackThermalDiffusion::RedbackThermalDiffusion(const InputParameters & parameters) : - Kernel(parameters), _time_factor(getParam("time_factor")) + Kernel(parameters), + _diffusivity(getMaterialProperty("thermal_diffusivity")), + _time_factor(getParam("time_factor")) { } @@ -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 ]; } diff --git a/src/materials/RedbackMaterial.C b/src/materials/RedbackMaterial.C index 934ff2c0..7a8a7651 100644 --- a/src/materials/RedbackMaterial.C +++ b/src/materials/RedbackMaterial.C @@ -102,6 +102,7 @@ validParams() params.addParam("fluid_thermal_expansion", 0, "fluid expansion (lambda^{(f)} in 1/K)"); // _fluid_thermal_expansion_param + params.addParam("thermal_diffusivity", 1, "normalised thermal diffusivity (-)"); // _thermal_diffusivity_param params.addParam("solid_density", 2.5, "normalised solid density (-)"); // solid_density_param params.addParam("fluid_density", 1, "normalised fluid density (-)"); // fluid_density_param @@ -164,6 +165,7 @@ RedbackMaterial::RedbackMaterial(const InputParameters & parameters) : _fluid_compressibility_param(getParam("fluid_compressibility")), _solid_thermal_expansion_param(getParam("solid_thermal_expansion")), _fluid_thermal_expansion_param(getParam("fluid_thermal_expansion")), + _thermal_diffusivity_param(getParam("thermal_diffusivity")), _solid_density_param(getParam("solid_density")), _fluid_density_param(getParam("fluid_density")), @@ -224,6 +226,7 @@ RedbackMaterial::RedbackMaterial(const InputParameters & parameters) : _fluid_compressibility(declareProperty("fluid_compressibility")), _solid_thermal_expansion(declareProperty("solid_thermal_expansion")), _fluid_thermal_expansion(declareProperty("fluid_thermal_expansion")), + _thermal_diffusivity(declareProperty("thermal_diffusivity")), _mixture_density(declareProperty("mixture_density")), @@ -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; diff --git a/tests/benchmark_1_T/bench1_a.i b/tests/benchmark_1_T/bench1_a.i index 146ed4e6..40001d05 100644 --- a/tests/benchmark_1_T/bench1_a.i +++ b/tests/benchmark_1_T/bench1_a.i @@ -36,7 +36,7 @@ variable = temp [../] [./diff_temp] - type = Diffusion + type = RedbackThermalDiffusion variable = temp [../] [./mh_temp] @@ -150,4 +150,3 @@ block = 0 [../] [] - diff --git a/tests/benchmark_1_T/bench1_b.i b/tests/benchmark_1_T/bench1_b.i index ba05b9b4..7f91e135 100644 --- a/tests/benchmark_1_T/bench1_b.i +++ b/tests/benchmark_1_T/bench1_b.i @@ -36,7 +36,7 @@ variable = temp [../] [./diff_temp] - type = Diffusion + type = RedbackThermalDiffusion variable = temp [../] [./mh_temp] diff --git a/tests/benchmark_1_T/bench1_c.i b/tests/benchmark_1_T/bench1_c.i index aa1e8d67..45d90dcf 100644 --- a/tests/benchmark_1_T/bench1_c.i +++ b/tests/benchmark_1_T/bench1_c.i @@ -43,7 +43,7 @@ variable = temp [../] [./diff_temp] - type = Diffusion + type = RedbackThermalDiffusion variable = temp [../] [./mh_temp] diff --git a/tests/benchmark_1_T/bench1_d.i b/tests/benchmark_1_T/bench1_d.i index e06ef775..009d017f 100644 --- a/tests/benchmark_1_T/bench1_d.i +++ b/tests/benchmark_1_T/bench1_d.i @@ -43,7 +43,7 @@ variable = temp [../] [./diff_temp] - type = Diffusion + type = RedbackThermalDiffusion variable = temp [../] [./mh_temp] diff --git a/tests/benchmark_1_T/diffusion_2_zones.i b/tests/benchmark_1_T/diffusion_2_zones.i new file mode 100644 index 00000000..d91e33a2 --- /dev/null +++ b/tests/benchmark_1_T/diffusion_2_zones.i @@ -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' + [../] +[] + diff --git a/tests/benchmark_1_T/gold/diffusion_2_zones.csv b/tests/benchmark_1_T/gold/diffusion_2_zones.csv new file mode 100644 index 00000000..503c49a8 --- /dev/null +++ b/tests/benchmark_1_T/gold/diffusion_2_zones.csv @@ -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 diff --git a/tests/benchmark_1_T/tests b/tests/benchmark_1_T/tests index 52973a0e..be4be6e5 100644 --- a/tests/benchmark_1_T/tests +++ b/tests/benchmark_1_T/tests @@ -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' + [../] []