<< Click to Display Table of Contents >> 1d_periodic |
{ 1D_PERIODIC.PDE
This example shows the use of FlexPDE in one-dimensional applications with periodic boundaries.
The PERIODIC statement appears in the position of a boundary condition, but
the syntax is slightly different, and the requirements and implications are
more extensive.
The syntax in 1D is:
POINT PERIODIC()
The mapping expressions specify the arithmetic required to convert the immediate point
(X) to a remote point (X').
The transformation must be invertible; do not specify
constants as mapped coordinates, as this will create a singular transformation.
The periodic boundary statement terminates any boundary conditions in effect,
and instead imposes equality of all variables on the two boundaries. It is
still possible to state a boundary condition on the remote boundary,
but in most cases this would be inappropriate.
The POINT_PERIODIC statement affects only the immediately preceding point.
The next appearing LINE statement terminates the periodic condition unless the periodic
statement is repeated.
We will define a periodic segment (-1,1) that is conceptually repeated in + and -X.
A heat source H2 is defined in a small subsection (X0,X1) of the line.
Since there are no sidewalls to constrain the solution, we must program a
heat sink H1 in the remaining parts of the domain, so that the heat generated by H2
is exactly absorbed by H1.
}
title '1D PERIODIC BOUNDARY TEST'
coordinates cartesian1
variables
u
definitions
k
h
x0=0.5
x1=0.8
h2 = 1 ! the heat source in region 2 (energy per unit length)
h1 = -(x1-x0)*h2/(2-x1+x0) ! this is the value of H1 which applied over (-1,X0) and (X1,1) will balance H2 applied over (X0,X1)
equations
u : div(K*grad(u)) + h = 0
! since there are no fixed values in the domain, the system is ill-posed (solution is not unique). So we add a constraint to make the solution unique.
constraints
integral(u)=0
boundaries
region 1
k = 1e-3
h = h1
start(-1)
line to (x0) to (x1) to (1)
point periodic(x-2)
{ an off-center heat source provides the asymmetric conditions to
demonstrate the periodicity of the solution }
region 2
h=h2
k=1e-4
start(x0) line to (x1)
monitors
grid(x)
elevation(u)
plots
grid(x)
elevation(u)
report(h1) report(h2)
report(integral(h,1)) report(integral(h,2))
end