{ GAUS3D.PDE
This test solves a 3D heat equation with a known Gaussian solution and compares
actual deviations from the exact solution with the error estimates made by
FlexPDE.
The problem runs a set of ERRLIM levels and plots the history of the comparison.
The equation is solved in two forms, letting FlexPDE compute the correct source,
and imposing analytic derivatives for the source.
}
title '3D Accuracy Test - Gaussian'
coordinates
cartesian3
select
ngrid = 5
stages = 3
errlim = staged(1e-2, 1e-3, 1e-4)
variables
u,v
definitions
long = 1
wide = 1
z1 = -1
z2 = 1
w = 0.25 ! gaussian width
uexact = exp(-(x^2+y^2+z^2)/w^2)
sfpde = -(dxx(uexact)+dyy(uexact)+dzz(uexact)) ! let FlexPDE do the differentials
sexact = -(4/w^4*(x^2+y^2+z^2) - 6/w^2)*uexact ! manual differentiation
initial values
u = 0.
equations
U: div(grad(u)) + sfpde = 0
V: div(grad(v)) + sexact = 0
extrusion z = z1,z2
boundaries
surface 1 value(u)=uexact value(v)=uexact { fix bottom surface temp }
surface 2 value(u)=uexact value(v)=uexact { fix top surface temp }
Region 1 { define full domain boundary in base plane }
start(-wide,-wide)
value(u) = uexact value(v)=uexact { fix all side temps }
line to (wide,-wide) { walk outer boundary in base plane }
to (wide,wide)
to (-wide,wide)
to close
monitors
grid(x,z) on y=0
contour(uexact) on y=0
contour(u) on y=0
contour(v) on y=0
contour(u-uexact) on y=0
contour(v-uexact) on y=0
plots
grid(x,z) on y=0
contour(uexact) on y=0
contour(u) on y=0
contour(v) on y=0
contour(u-uexact) on y=0
contour(v-uexact) on y=0
elevation(uexact,u,v) from(-wide,0,0) to (wide,0,0)
elevation(sfpde,sexact) from(-wide,0,0) to (wide,0,0)
summary
report(errlim)
report(sqrt(integral((u-uexact)^2)/sqrt(integral(uexact^2))))
report(sqrt(integral((v-uexact)^2)/sqrt(integral(uexact^2))))
histories
history(sqrt(integral((u-uexact)^2)/sqrt(integral(uexact^2))), errlim) log
end
Page url: index.html?usage_accuracy_gaus3d.html