﻿ Sample Problems > Usage > Misc > bc_switching

bc_switching

Navigation:  Sample Problems > Usage > Misc >

bc_switching   { BC_SWITCHING.PDE

This script demonstrates a technique for switching a boundary condition

from NATURAL to VALUE. FlexPDE does not allow this switch directly, but

it can be mimicked by using a NATURAL condition that is equivalent to the

VALUE condition.

To achieve this, one can apply a flux that drives the boundary to the

desired value. The flux is a "large" penalty term multiplied by the

difference of the desired value (U0) and the actual value :

NATURAL(U) = penalty*(U0-U)

The size of the penalty term will dictate how rigorously the value is

tracked.

Now the switching boundary condition can be implemented in an IF statement:

NATURAL(U) = IF condition THEN penalty*(U0-U) ELSE otherflux

}

title "Boundary Condition Switching"

variables Temp

definitions

penalty = 300 { penalty for value bc }

Temp0 = 15     { ambient temperature }

heater = 315   { heater temperature }

h = 1         { block size }

k = 0.85       { thermal conductivity }

cp = 1         { heat capacity }

rt = 0.5       { heater ramp time }

delta = h/4 + URAMP(t-1,t-5)*h/2 { moving point for BC switch }

equations

initial values

Temp = Temp0

boundaries

region 1

start(0,0)

line to (h,0)

natural(Temp) = if (y > delta) then penalty*(Temp0-Temp) else 0

line to (h,h)

nobc(Temp)

line to (0,h)

value(Temp) = RAMP(t-rt,Temp0,heater,2*rt)

line to close

time 0 to 6 by 1e-4

monitors

for cycle = 10

contour(Temp)

elevation(Temp) from(h,0) to (h,h)

plots

for t = 1 by 1 to 6

contour(Temp)

elevation(Temp) from(h,0) to (h,h)

histories

history(Temp) at (0,h/2), (h,h/5), (h,4*h/5)

end