﻿ Sample Problems > Usage > Sequenced_Equations > smoothing_discontinuities

# smoothing_discontinuities

Navigation:  Sample Problems > Usage > Sequenced_Equations >

# 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 first-order backward finite-difference approximation to the time derivative is dt(u) ~ (u-u0)/deltat0.

This creates an implicit steady-state equation for the value at the end of the initial time deltat0:

We use the INITIAL EQUATIONS facility to solve this system before beginning the time evolution.

}

variables

u(threshold=0.1)     { fraction of external concentration }

definitions

concs = 1.8e8             { surface concentration  atom/micron^3}

D = 1.1e-2               { 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(y-0.3,y-0.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

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(u-uexact1d) 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