Commit b69d8355 authored by Kevin Dugan's avatar Kevin Dugan

Adding template example

parent ecdd8e2a
# 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 = 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 = NekExecutioner
scheme = bdf2
nl_rel_tol = 1e-12
l_tol = 1e-6
dt = 2
end_time = 100
num_steps = 10
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[./TimeStepper]
type = NekTimeStepper
[../]
[]
[Outputs]
exodus = true
print_perf_log = true
[]
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
c Note: In the new code, LELGEC should be about sqrt(LELG)
c
PARAMETER (LELGEC = 1)
PARAMETER (LXYZ2 = 1)
PARAMETER (LXZ21 = 1)
PARAMETER (LMAXV=LX1*LY1*LZ1*LELV)
PARAMETER (LMAXT=LX1*LY1*LZ1*LELT)
PARAMETER (LMAXP=LX2*LY2*LZ2*LELV)
PARAMETER (LXZ=LX1*LZ1)
PARAMETER (LORDER=3)
PARAMETER (MAXOBJ=4,MAXMBR=LELT*6)
PARAMETER (lhis=100) ! # of pts a proc reads from hpts.in
! Note: lhis*np > npoints in hpts.in
C
C Common Block Dimensions
C
PARAMETER (LCTMP0 =2*LX1*LY1*LZ1*LELT)
PARAMETER (LCTMP1 =4*LX1*LY1*LZ1*LELT)
C
C The parameter LVEC controls whether an additional 42 field arrays
C are required for Steady State Solutions. If you are not using
C Steady State, it is recommended that LVEC=1.
C
PARAMETER (LVEC=1)
C
C Uzawa projection array dimensions
C
parameter (mxprev = 40)
parameter (lgmres = 40)
C
C Split projection array dimensions
C
parameter(lmvec = 1)
parameter(lsvec = 1)
parameter(lstore=lmvec*lsvec)
c
c NONCONFORMING STUFF
c
parameter (maxmor = lelt)
C
C Array dimensions
C
COMMON/DIMN/NELV,NELT,NX1,NY1,NZ1,NX2,NY2,NZ2
$,NX3,NY3,NZ3,NDIM,NFIELD,NPERT,NID
$,NXD,NYD,NZD
c automatically added by makenek
parameter(lxo = lx1) ! max output grid size (lxo>=lx1)
c automatically added by makenek
parameter(lpart = 62000) ! max number of particles
c automatically added by makenek
integer ax1,ay1,az1,ax2,ay2,az2
parameter (ax1=1,ay1=1,az1=1,ax2=1,ay2=1,az2=1) ! running averages
c automatically added by makenek
parameter (lxs=1,lys=lxs,lzs=(lxs-1)*(ldim-2)+1) !New Pressure Preconditioner
c automatically added by makenek
parameter (lfdm=0) ! == 1 for fast diagonalization method
c automatically added by makenek
common/IOFLAG/nio ! for logfile verbosity control
c automatically added by makenek
integer toteq
parameter(toteq = 1 ) ! Number of conserved variables
c IFCMT=FALSE then toteq=1
c automatically added by makenek
integer lelcmt
parameter(lelcmt = 1 ) ! # of cmt elements
c IFCMT=FALSE then lelcmt=1
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[./u]
[../]
[]
[AuxVariables]
[./aux]
[../]
[]
[Kernels]
[./diff]
type = CoefDiffusion
variable = u
coef = 0.1
[../]
[./time]
type = TimeDerivative
variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
# Preconditioned JFNK (default)
type = Transient
num_steps = 20
dt = 0.1
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
# picard_max_its = 30
nl_abs_tol = 1e-14
[]
[Outputs]
exodus = true
[]
[MultiApps]
[./sub]
type = TransientMultiApp
app_type = GiraffeApp
positions = '0 0 0'
input_files = picard_sub.i
[../]
[]
[Transfers]
[./u_to_sub]
type = MultiAppNearestNodeTransfer
direction = to_multiapp
multi_app = sub
source_variable = u
variable = aux
[../]
[./u_from_sub]
type = MultiAppNearestNodeTransfer
direction = from_multiapp
multi_app = sub
source_variable = u
variable = aux
[../]
[]
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[./u]
[../]
[]
[AuxVariables]
[./aux]
[../]
[]
[Kernels]
[./diff]
type = CoefDiffusion
variable = u
coef = 0.1
[../]
[./time]
type = TimeDerivative
variable = u
[../]
[]
[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]
[Executioner]
# Preconditioned JFNK (default)
type = Transient
num_steps = 20
dt = 0.1
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
# picard_max_its = 30
nl_abs_tol = 1e-14
[]
[Outputs]
exodus = true
[]
[MultiApps]
[./sub]
type = TransientMultiApp
app_type = GiraffeApp
sub_cycling = true
positions = '0 0 0'
input_files = picard_sub_subcycling.i
[../]
[]
[Transfers]
[./u_to_sub]
type = MultiAppNearestNodeTransfer
direction = to_multiapp
multi_app = sub
source_variable = u
variable = aux
[../]
[./u_from_sub]
type = MultiAppNearestNodeTransfer
direction = from_multiapp
multi_app = sub
source_variable = u
variable = aux
[../]
[]
# Minimal Nek-wrapped MOOSE application.
# MOOSE Requires a mesh and a variable even
# if they are not used.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[./u]
[../]
[]
[AuxVariables]
[./aux]
[../]
[]
[Executioner]
type = NekExecutioner
num_steps = 20
[./TimeStepper]
type = NekTimeStepper
[../]
[]
[Problem]
kernel_coverage_check = false
solve = false
[]
# Minimal Nek-wrapped MOOSE application.
# MOOSE Requires a mesh and a variable even
# if they are not used.
[Mesh]
type = GeneratedMesh
dim = 1
nx = 1
[]
[Variables]
[./u]
[../]
[]
[AuxVariables]
[./aux]
[../]
[]
[Executioner]
type = NekExecutioner
num_steps = 20
[./TimeStepper]
type = NekTimeStepper
dt = 0.01
[../]
[]
[Problem]
kernel_coverage_check = false
solve = false
[]
This diff is collapsed.
This diff is collapsed.
c-----------------------------------------------------------------------
C
C USER SPECIFIED ROUTINES:
C
C - boundary conditions
C - initial conditions
C - variable properties
C - local acceleration for fluid (a)
C - forcing function for passive scalar (q)
C - general purpose routine for checking errors etc.
C
c-----------------------------------------------------------------------
subroutine uservp (ix,iy,iz,eg)
include 'SIZE'
include 'TOTAL'
include 'NEKUSE'
integer e,f,eg
udiff =0.
utrans=0.
return
end
c-----------------------------------------------------------------------
subroutine userf (ix,iy,iz,eg)
include 'SIZE'
include 'TOTAL'
include 'NEKUSE'
integer e,f,eg
ffx=0.0
ffy=0.0
ffz=0.0
return
end
c-----------------------------------------------------------------------
subroutine userq (ix,iy,iz,eg)
include 'SIZE'
include 'TOTAL'
include 'NEKUSE'
integer e,f,eg
c e = gllel(eg)
qvol = 0.0
return
end
c-----------------------------------------------------------------------
subroutine userchk
include 'SIZE'
include 'TOTAL'
common/test_passing/ flux_moose, temp_nek
real sint, sint1, sarea, sarea1, wtmp
integer e, f
n1=nelt*lx1*ly1*lz1
n2=nelt*lx2*ly2*lz2
pmin=glmin(pr,n2)
pmax=glmax(pr,n2)
wmin=glmin(vz,n1)
wmax=glmax(vz,n1)
tmin=glmin(t,n1)
tmax=glmax(t,n1)
ifflow=.false.
sint1=0.0
sarea1=0.0
do e=1,lelt
do f=1,6
call surface_int(sint,sarea,t,e,f)
if (cbc(f,e,1).eq.'W ') then
sint1=sint1+sint
sarea1=sarea1+sarea
endif
enddo
enddo
call gop(sint1,wtmp,'+ ',1)
call gop(sarea1,wtmp,'+ ',1)
temp_nek=sint1/sarea1
if (nid.eq.0) then
write(6,*)"*** Temperature: ",tmin," - ",tmax
write(6,*)"*** Av. Temperature: ",temp_nek
endif
return
end
c-----------------------------------------------------------------------
subroutine userbc (ix,iy,iz,iside,ieg)
include 'SIZE'
include 'TOTAL'
include 'NEKUSE'
common/test_passing/ flux_moose, temp_nek
integer e,ieg
real ucx, ucy, ucz, ucy_e, yy
e=gllel(ieg)
zz = zm1(ix,iy,iz,e)
xx = xm1(ix,iy,iz,e)
yy = ym1(ix,iy,iz,e)
rr = sqrt(xx**2 + yy**2)
ux = 0.0
uy = 0.0
uz = 1.0
temp = 0.0
flux = 1.0 !flux_moose
return
end
c-----------------------------------------------------------------------
subroutine useric (ix,iy,iz,ieg)
include 'SIZE'
include 'TOTAL'
include 'NEKUSE'
integer idum, e
save idum
data idum / 0 /
if (idum.eq.0) idum = 99 + nid
eps = .35
uz=0.0
uy=0.0
ux=0.0
temp=0
return
end
c-----------------------------------------------------------------------
subroutine usrdat
include 'SIZE'
include 'TOTAL'
return
end
c-----------------------------------------------------------------------
subroutine usrdat2