<< Click to Display Table of Contents >> smoothing_discontinuities 

{ SMOOTHING_DISCONTINUITIES.PDE
This problem is a variation of DIFFUSION.PDE.
It employs an approximation to smooth the effects of discontinuous initial conditions.
We specify a discontinuous initial condition, zero internally with a value of 1.0 on the boundary.
The equation is div(D*grad(u)) = dt(u).
A firstorder backward finitedifference approximation to the time derivative is dt(u) ~ (uu0)/deltat0.
This creates an implicit steadystate equation for the value at the end of the initial time deltat0:
div(D*grad(u)) = (u  u0)/deltat0.
We use the INITIAL EQUATIONS facility to solve this system before beginning the time evolution.
}
title 'Masked Diffusion'
variables
u(threshold=0.1) { fraction of external concentration }
definitions
concs = 1.8e8 { surface concentration atom/micron^3}
D = 1.1e2 { diffusivity micron^2/hr}
conc = concs*u
cexact1d = concs*erfc(x/(2*sqrt(D*t)))
uexact1d = erfc(x/(2*sqrt(D*t))) { masked surface flux multiplier }
M = upulse(y0.3,y0.7)
u0 = 0
dt0 = 0.05
initial equations
u: div(D*grad(u)) = (u  u0)/dt0 ! finite difference over time for a first step
equations
u : div(D*grad(u)) = dt(u)
boundaries
region 1
start(0,0)
natural(u) = 0
line to (1,0) to (1,1) to (0,1)
value(u) = M
line to close
feature { a "gridding feature" to help localize the activity }
start (0.02,0.3) line to (0.02,0.7)
time dt0 to 1 by 0.001
plots
for t=dt0 0.1 by 0.05 to 0.2 by 0.1 to endtime
contour(u)
surface(u)
elevation(u,uexact1d) from (0,0.5) to (1,0.5)
elevation(uuexact1d) from (0,0.5) to (1,0.5)
histories
history(u) at (0.05,0.5) (0.1,0.5) (0.15,0.5) (0.2,0.5)
end