Commit 3a848402 authored by Kevin Dugan's avatar Kevin Dugan

Adding coupled heat conduction w/o MOOSE source

parent e1bb303b
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
type = GeneratedMesh
dim = 1
nx = 160
xmax = 80
[]
[Variables]
[./T]
[../]
[]
[ICs]
[./T_IC]
type = FunctionIC
variable = T
function = '100*sin(3.14159*x/80)'
[../]
[]
[Kernels]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = T
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = T
boundary = right
value = 0
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '0.95' #copper in cal/(cm sec C)
block = 0
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '0.092' #copper in cal/(g C)
block = 0
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '8.92' #copper in g/(cm^3)
block = 0
[../]
[]
[Postprocessors]
[./error]
type = NodalL2Error
function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
variable = T
[../]
[]
[Executioner]
type = Transient
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
end_time = 100
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
# This is a circle from x=(-0.5, 0.5) and y=(-0.5,0.5)
file = 2D_circle_sideset.exo
block_id = '1'
block_name = 'interior'
boundary_id = '100'
boundary_name = 'wall'
[]
[Variables]
[./T]
[../]
[]
[ICs]
[./T_IC]
type = FunctionIC
variable = T
# function = 'exp(-3.14159*(x*x+y*y))'
function = '0.0'
[../]
[]
[Kernels]
[./HeatSource]
type = HeatSource
function = '1.0'
variable = T
[../]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[Functions]
# BCFunction just returns 0.0 right now
[./bc_func]
type = BCFunction
[../]
[]
[BCs]
[./wall]
type = FunctionDirichletBC
variable = T
boundary = 'wall'
function = bc_func
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '1'
block = 'interior'
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '1'
block = 'interior'
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '1'
block = 'interior'
[../]
[]
# [Postprocessors]
# [./error]
# type = NodalL2Error
# function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
# variable = T
# [../]
# []
[Executioner]
type = Transient
scheme = bdf2 # Others available: backward Euler, Crank-Nicholson, etc.
#scheme = 'Explicit-Euler'
dt = 0.001 # Initial timestep size
start_time = 0 # Starting time
#num_steps = 200 # DIVERGES AFTER 6 TIMESTEPS...
num_steps = 1 # DIVERGES AFTER 6 TIMESTEPS...
nl_rel_tol = 1e-8 # Nonlinear relative tolerance
l_tol = 1e-6 # Linear tolerance
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
type = GeneratedMesh
dim = 2
nx = 40
ny = 40
xmax = 80
ymax = 80
[]
[Variables]
[./T]
[../]
[]
[Kernels]
[./HeatSource]
type = HeatSource
function = '100*sin(3.14159*x/80)*sin(3.14159*y/80)'
variable = T
[../]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = T
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = T
boundary = right
value = 0
[../]
[./top]
type = DirichletBC
variable = T
boundary = top
value = 0
[../]
[./bottom]
type = DirichletBC
variable = T
boundary = bottom
value = 0
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '0.95' #copper in cal/(cm sec C)
block = 0
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '0.092' #copper in cal/(g C)
block = 0
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '8.92' #copper in g/(cm^3)
block = 0
[../]
[]
[Postprocessors]
[./error]
type = NodalL2Error
function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
variable = T
[../]
[]
[Executioner]
type = Transient
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
end_time = 100
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
type = GeneratedMesh
dim = 3
nx = 20
ny = 20
nz = 20
xmax = 80
ymax = 80
zmax = 80
[]
[Variables]
[./T]
[../]
[]
[Kernels]
[./HeatSource]
type = HeatSource
function = '100*sin(3.14159*x/80)*sin(3.14159*y/80)*sin(3.14159*z/80)'
variable = T
[../]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = T
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = T
boundary = right
value = 0
[../]
[./top]
type = DirichletBC
variable = T
boundary = top
value = 0
[../]
[./bottom]
type = DirichletBC
variable = T
boundary = bottom
value = 0
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '0.95' #copper in cal/(cm sec C)
block = 0
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '0.092' #copper in cal/(g C)
block = 0
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '8.92' #copper in g/(cm^3)
block = 0
[../]
[]
[Postprocessors]
[./error]
type = NodalL2Error
function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
variable = T
[../]
[]
[Executioner]
type = Transient
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
#end_time = 100
end_time = 10
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
# This is a cylinder with r=0.5, z=(0,1)
file = 3D_sideset.exo
block_id = '1'
block_name = 'interior'
boundary_id = '100 200 300'
boundary_name = 'top bottom wall'
[]
[Variables]
[./T]
[../]
[]
[ICs]
[./T_IC]
type = FunctionIC
variable = T
# function = 'exp(-3.14159*(x*x+y*y))'
function = '0.0'
[../]
[]
[Kernels]
[./HeatSource]
type = HeatSource
# function = '100*cos(3.14159*x)*cos(3.14159*y)'
function = '1.0'
variable = T
[../]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
[Functions]
# BCFunction just returns 0.0 right now
[./bc_func]
type = BCFunction
[../]
[]
[BCs]
[./top]
type = FunctionDirichletBC
variable = T
boundary = 'top'
function = bc_func
[../]
[./bottom]
type = FunctionDirichletBC
variable = T
boundary = 'bottom'
function = bc_func
[../]
[./wall]
type = FunctionDirichletBC
variable = T
boundary = 'wall'
function = bc_func
[../]
[]
[Materials]
[./k]
type = GenericConstantMaterial
prop_names = 'thermal_conductivity'
prop_values = '1'
block = 'interior'
[../]
[./cp]
type = GenericConstantMaterial
prop_names = 'specific_heat'
prop_values = '1'
block = 'interior'
[../]
[./rho]
type = GenericConstantMaterial
prop_names = 'density'
prop_values = '1'
block = 'interior'
[../]
[]
[Postprocessors]
[./error]
type = NodalL2Error
function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
variable = T
[../]
[]
[Executioner]
type = Transient
scheme = 'Explicit-Euler' # Others available: backward Euler, Crank-Nicholson, etc.
dt = 0.001 # Initial timestep size
start_time = 0 # Starting time
num_steps = 20 # DIVERGES AFTER 4 TIMESTEPS
nl_rel_tol = 1e-8 # Nonlinear relative tolerance
l_tol = 1e-6 # Linear tolerance
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
# This test solves a 1D transient heat equation
# The error is caclulated by comparing to the analytical solution
# The problem setup and analytical solution are taken from "Advanced Engineering
# Mathematics, 10th edition" by Erwin Kreyszig.
# http://www.amazon.com/Advanced-Engineering-Mathematics-Erwin-Kreyszig/dp/0470458364
# It is Example 1 in section 12.6 on page 561
[Mesh]
file = 3D.exo
[]
[Variables]
[./T]
[../]
[]
[ICs]
[./T_IC]
type = FunctionIC
variable = T
function = '100*sin(3.14159*x/80)*sin(3.14159*y/80)'
[../]
[]
[Kernels]
[./HeatDiff]
type = HeatConduction
variable = T
[../]
[./HeatTdot]
type = HeatConductionTimeDerivative
variable = T
[../]
[]
# [BCs]
# [./top]
# type = DirichletBC
# variable = T
# boundary = top
# value = 0
# [../]
# [./bottom]
# type = DirichletBC
# variable = T
# boundary = bottom
# value = 100
# [../]
# []
# [Materials]
# [./k]
# type = GenericConstantMaterial
# prop_names = 'thermal_conductivity'
# prop_values = '0.95' #copper in cal/(cm sec C)
# block = 0
# [../]
# [./cp]
# type = GenericConstantMaterial
# prop_names = 'specific_heat'
# prop_values = '0.092' #copper in cal/(g C)
# block = 0
# [../]
# [./rho]
# type = GenericConstantMaterial
# prop_names = 'density'
# prop_values = '8.92' #copper in g/(cm^3)
# block = 0
# [../]
# []
[Postprocessors]
[./error]
type = NodalL2Error
function = '100*sin(3.14159*x/80)*exp(-0.95/(0.092*8.92)*3.14159^2/80^2*t)' #T(x,t) = 100sin(pix/L)exp(-rho/(cp k) pi^2/L^2 t)
variable = T
[../]
[]
[Executioner]
type = Transient
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
end_time = 100
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
print_perf_log = true
[]
This app is taken from moose/modules/heat_conduction/tests.
The source code for HeatConduction module itself
(moose/modules/heat_conduction) is copied here. Likewise, the HeatConduction
module itself be recompiled when compiling this example, even HeatConduction
was compiled with the rest of the MOOSE framework. This is redundant and can
surely be elminated with some refinements to the example's Makefile (TODO).
The following config files are also taken from moose/modules/heat_conduction/tests/heat_conduction:
* 1D_transient.i
* 2d_steady_state_final_prob.i
Theese config files are for coupling with Nek5000:
* 2d_transient_square.i
* 2d_transient_circle.i
* 3d_transient_cylinder.i
C Dimension file to be included
C
C HCUBE array dimensions
C
parameter (ldim=3)
parameter (lx1=5,ly1=lx1,lz1=lx1,lelt=480,lelv=lelt)
parameter (lxd=8,lyd=lxd,lzd=lxd)
parameter (lelx=1,lely=1,lelz=1)
parameter (lzl=3 + 2*(ldim-3))
parameter (lx2=lx1-2)
parameter (ly2=ly1-2)
parameter (lz2=lz1-2)
parameter (lx3=lx1)
parameter (ly3=ly1)
parameter (lz3=lz1)
parameter (lp = 32)
parameter (lelg = 500)
c
c parameter (lpelv=lelv,lpelt=lelt,lpert=3) ! perturbation
c parameter (lpx1=lx1,lpy1=ly1,lpz1=lz1) ! array sizes
c parameter (lpx2=lx2,lpy2=ly2,lpz2=lz2)
c
parameter (lpelv=1,lpelt=1,lpert=1) ! perturbation
parameter (lpx1=1,lpy1=1,lpz1=1) ! array sizes
parameter (lpx2=1,lpy2=1,lpz2=1)
c
c parameter (lbelv=lelv,lbelt=lelt) ! MHD
c parameter (lbx1=lx1,lby1=ly1,lbz1=lz1) ! array sizes
c parameter (lbx2=lx2,lby2=ly2,lbz2=lz2)
c
parameter (lbelv=1,lbelt=1) ! MHD
parameter (lbx1=1,lby1=1,lbz1=1) ! array sizes
parameter (lbx2=1,lby2=1,lbz2=1)
C LX1M=LX1 when there are moving meshes; =1 otherwise
parameter (lx1m=lx1,ly1m=ly1,lz1m=lz1)
parameter (ldimt= 4) ! 3 passive scalars + T
parameter (ldimt1=ldimt+1)
parameter (ldimt3=ldimt+3)
c