Skip to content
Snippets Groups Projects
Commit 17d61651 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Add convection diffusion reaction system

parent 4de9cb02
No related branches found
No related tags found
No related merge requests found
add_subdirectory(conv_diff_reac)
add_subdirectory(poisson_dg) add_subdirectory(poisson_dg)
add_subdirectory(poisson_dg_tensor) add_subdirectory(poisson_dg_tensor)
dune_add_formcompiler_system_test(UFLFILE cdr_ernupwind.ufl
BASENAME app_cdr_ernupwind
INIFILE cdr_ernupwind.mini
NO_TESTS
)
dune_add_formcompiler_system_test(UFLFILE conv_diff_dg_ernupwind.ufl
BASENAME verify_app_cdr_ernupwind
INIFILE verify_ernupwind.mini
NO_TESTS
)
__name = app_nonlinear_conv_diff_condupwind_{__exec_suffix}
__exec_suffix = deg{formcompiler.ufl_variants.degree}_{opcount_suffix}_level{formcompiler.instrumentation_level}
opcount_suffix = opcount, nonopcount | expand opcount
{opcount_suffix} == opcount and {formcompiler.instrumentation_level} != 4 | exclude
# Calculate the size of the grid to equlibritate it to 100 MB/rank
# Input parameters
dim = 3
mbperrank = 100
ranks = 16
floatingbytes = 8
# Metaini Calculations
memperrank = {mbperrank} * 1048576 | eval
dofsperdir = {formcompiler.ufl_variants.degree} + 1 | eval
celldofs = {dofsperdir} ** {dim} | eval
cellsperrank = {memperrank} / ({floatingbytes} * {celldofs}) | eval
cellsperdir = {cellsperrank} ** (1/{dim}) | eval | toint
firstdircells = {ranks} * {cellsperdir} | eval
dimminusone = {dim} - 1 | eval
ones = 1 | repeat {dimminusone}
otherdircells = {cellsperdir} | repeat {dimminusone}
# Setup the grid!
extension = 1.0 | repeat {dim}
cells = {firstdircells} {otherdircells}
partitioning = {ranks} {ones}
# Set up the timing identifier
identifier = nonlinear_convdiff_condupwind_deg{formcompiler.ufl_variants.degree}
[wrapper.vtkcompare]
name = {__name}
extension = vtu
[formcompiler]
fastdg = 1
sumfact = 1
vectorize_quad = 1
vectorize_grads = 1
instrumentation_level = 2, 3, 4 | expand
opcounter = 1, 0 | expand opcount
time_opcounter = 0, 1 | expand opcount
exact_solution_expression = g
compare_l2errorsquared = 1e-6
quadrature_order = {formcompiler.ufl_variants.degree} * 2 | eval
[formcompiler.ufl_variants]
cell = hexahedron
degree = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | expand
dim = 3
x = SpatialCoordinate(cell)
g = x[0]*x[0] + x[1]*x[1] + x[2]*x[2]
I = Identity(3)
A = as_matrix([[x[i]*x[j] + I[i,j] for j in range(3)] for i in range(3)])
f = -6.
c = 5.
b = x
V = FiniteElement("DG", cell, degree)
u = TrialFunction(V)
v = TestFunction(V)
n = FacetNormal(cell)('+')
alpha = 3.0
h_ext = CellVolume(cell) / FacetArea(cell)
cse_gamma_ext = (alpha * degree * (degree + dim - 1)) / h_ext
h_int = Min(CellVolume(cell)('+'), CellVolume(cell)('-')) / FacetArea(cell)
cse_gamma_int = (alpha * degree * (degree + dim - 1)) / h_int
upwind = conditional(inner(b, n) > 0, u('+'), u('-'))
theta = -1.0
r = (inner(A*grad(u) - b*u, grad(v)) + (c*u-f)*v)*dx \
+ (inner(n, A*avg(grad(u))) + inner(b*upwind, n))*jump(v)*dS \
+ cse_gamma_int*jump(u)*jump(v)*dS \
- theta*jump(u)*inner(A*avg(grad(v)), n)*dS \
- inner(n, A*grad(u) + b*u)*v*ds \
+ cse_gamma_ext*u*v*ds \
+ theta*u*inner(A*grad(v), n)*ds \
- theta*g*inner(A*grad(v), n)*ds \
- cse_gamma_ext*g*v*ds
forms = [r]
__name = app_nonlinear_conv_diff_ernupwind_{__exec_suffix}
__exec_suffix = deg{formcompiler.ufl_variants.degree}_{opcount_suffix}_level{formcompiler.instrumentation_level}
opcount_suffix = opcount, nonopcount | expand opcount
{opcount_suffix} == opcount and {formcompiler.instrumentation_level} != 4 | exclude
# Calculate the size of the grid to equlibritate it to 100 MB/rank
# Input parameters
dim = 3
mbperrank = 100
ranks = 16
floatingbytes = 8
# Metaini Calculations
memperrank = {mbperrank} * 1048576 | eval
dofsperdir = {formcompiler.ufl_variants.degree} + 1 | eval
celldofs = {dofsperdir} ** {dim} | eval
cellsperrank = {memperrank} / ({floatingbytes} * {celldofs}) | eval
cellsperdir = {cellsperrank} ** (1/{dim}) | eval | toint
firstdircells = {ranks} * {cellsperdir} | eval
dimminusone = {dim} - 1 | eval
ones = 1 | repeat {dimminusone}
otherdircells = {cellsperdir} | repeat {dimminusone}
# Setup the grid!
extension = 1.0 | repeat {dim}
cells = {firstdircells} {otherdircells}
partitioning = {ranks} {ones}
# Set up the timing identifier
identifier = nonlinear_convdiff_ernupwind_deg{formcompiler.ufl_variants.degree}
[wrapper.vtkcompare]
name = {__name}
extension = vtu
[formcompiler]
fastdg = 1
sumfact = 1
vectorize_quad = 1
vectorize_grads = 1
instrumentation_level = 2, 3, 4 | expand
opcounter = 1, 0 | expand opcount
time_opcounter = 0, 1 | expand opcount
exact_solution_expression = g
compare_l2errorsquared = 1e-6
quadrature_order = {formcompiler.ufl_variants.degree} * 2 | eval
[formcompiler.ufl_variants]
cell = hexahedron
degree = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | expand
dim = 3
x = SpatialCoordinate(cell)
g = x[0]*x[0] + x[1]*x[1] + x[2]*x[2]
I = Identity(3)
A = as_matrix([[x[i]*x[j] + I[i,j] for j in range(3)] for i in range(3)])
f = -6.
c = 5.
b = x
V = FiniteElement("DG", cell, degree)
u = TrialFunction(V)
v = TestFunction(V)
n = FacetNormal(cell)('+')
alpha = 3.0
h_ext = CellVolume(cell) / FacetArea(cell)
cse_gamma_ext = (alpha * degree * (degree + dim - 1)) / h_ext
h_int = Min(CellVolume(cell)('+'), CellVolume(cell)('-')) / FacetArea(cell)
cse_gamma_int = (alpha * degree * (degree + dim - 1)) / h_int
theta = -1.0
r = (inner(A*grad(u) - b*u, grad(v)) + (c*u-f)*v)*dx \
+ inner(n, A*avg(grad(u)))*jump(v)*dS \
- (avg(u) - 0.5*jump(u))*inner(b, n)*jump(v)*dS \
+ cse_gamma_int*jump(u)*jump(v)*dS \
- theta*jump(u)*inner(A*avg(grad(v)), n)*dS \
- inner(n, A*grad(u) + b*g)*v*ds \
+ cse_gamma_ext*u*v*ds \
+ theta*u*inner(A*grad(v), n)*ds \
- theta*g*inner(A*grad(v), n)*ds \
- cse_gamma_ext*g*v*ds
forms = [r]
__name = verify_app_cdr_ernupwind
# Setup the grid!
extension = 1.0 1.0 1.0
cells = 8 8 8
[wrapper.vtkcompare]
name = {__name}
extension = vtu
[formcompiler]
fastdg = 1
sumfact = 1
vectorize_quad = 1
vectorize_grads = 1
exact_solution_expression = g
compare_l2errorsquared = 1e-6
[formcompiler.ufl_variants]
cell = hexahedron
degree = 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment