<< Click to Display Table of Contents >> gaus2d |
{ GAUS2D.PDE
This test solves a 2D heat equation with a 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.
}
title '2D Accuracy Test - Gaussian'
variables
u
select
ngrid=5
errlim = staged(1e-2, 1e-3, 1e-4, 1e-5)
definitions
k = 1
h = 0.1
w = 0.2 ! gaussian width
u0 = exp(-(x^2+y^2)/w^2)
source = -(dxx(u0)+dyy(u0))
uxx_exact = dxx(u0)
RMS_error = sqrt(integral((u-u0)^2)/sqrt(integral(u0^2)))
fx = -2*x*u0/w^2
fy = -2*y*u0/w^2
equations
U: div(K*grad(u)) + source = 0
boundaries
Region 1
start(-1,-1) natural(u)=-fy line to (1,-1)
value(u)=u0 line to (1,1)
natural(u)=fy line to (-1,1)
value(u) = u0 line to close
monitors
grid(x,y)
contour(u)
plots
grid(x,y)
contour(u)
elevation(u,u0) from(-1,0) to (1,0)
elevation(u-u0) from(-1,0) to (1,0)
elevation(dxx(u),uxx_exact) from(-1,0) to (1,0)
elevation(dxx(u)+dyy(u),-source) from(-1,0) to (1,0)
contour(dxx(u)) contour(dxy(u)) contour(dyy(u))
contour(space_error(u))
contour(u-u0)
histories
history(RMS_error, errlim) LOG
end