﻿ Sample Problems > Usage > Accuracy > gaus3d

# gaus3d

Navigation:  Sample Problems > Usage > Accuracy >

# gaus3d   { 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

errlim = staged(1e-2, 1e-3, 1e-4, 1e-5)

variables

u

definitions

long = 1

wide = 1

z1 = -1

z2 = 1

w = 0.25 ! gaussian width

uexact = exp(-(x^2+y^2+z^2)/w^2)

source = -(dxx(uexact)+dyy(uexact)+dzz(uexact)) ! let FlexPDE do the differentials

RMS_error = sqrt(integral((u-uexact)^2)/sqrt(integral(uexact^2)))

initial values

u = 0.

equations

U:    div(flux) = source

extrusion z = z1,z2

boundaries

surface 1 value(u)=uexact     { fix bottom surface temp }

surface 2 value(u)=uexact     { fix top surface temp }

Region 1                   { define full domain boundary in base plane }

start(-wide,-wide)

value(u) = 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(u-uexact) on y=0

plots

grid(x,z) on y=0 as "Grid on X-Z cut"

contour(uexact) on y=0 as "Exact Solution Uexact"

contour(u) on y=0 as "Numerical Solution U"

contour(u-uexact) on y=0 as "Actual error U-Uexact"

elevation(u,uexact) from(-wide,0,0) to (wide,0,0)

elevation(dx(u),dx(uexact)) from(-wide,0,0) to (wide,0,0)

elevation(div(flux),source) from(-wide,0,0) to (wide,0,0)

summary

report(errlim)

report(RMS_error)

histories

history(RMS_error, errlim) log

end