﻿ Sample Problems > Usage > Integrals > 2d_integrals

2d_integrals

Navigation:  Sample Problems > Usage > Integrals >

2d_integrals   { 2D_INTEGRALS.PDE

This problem demonstrates the specification of various integrals in 2D.

}

title '2D Integrals'

coordinates

ycylinder

variables

Tp

select errlim=1e-4

definitions

R0 = 0.1

R1 = 0.4

R2 = 0.6

Long = 1.0

K                   { thermal conductivity -- values supplied later }

Q = 10*max(1-((r-R1)^2+z^2),0)             { Thermal source }

{ This definition shows the use of a selector to force integration of Tp only in inner region }

flag2=0

temp2 = if flag2>0 then Tp else 0

initial values

Tp = 0.

equations

Tp:    div(k*grad(Tp)) + Q = 0       { the heat equation }

boundaries

Region 1       { define full domain boundary }

K = 1

start "outside" (R0,-Long/2)

value(Tp) = 0     { fix all side temps }

line to (R2,-Long/2)

to (R2,Long/2)

to (R0,Long/2)

to close

Region 2 "Inner Region"

flag2=1

k=0.2

start "Inner Boundary" (R0,-Long/2)

line to (R1,-Long/2)

to (R1,Long/2)

to (R0,Long/2)

to close

monitors

contour(Tp)

plots

contour(Tp)

contour(k*dz(Tp))

contour(q)

summary

report("Compare various forms for integrating over region 2")

report(integral(Tp,2))

report(integral(Tp,"Inner Region"))

report(integral(temp2))   { integrates over full volume, but temp2 is zero in region 1 }

report '-----'

report("Compare various forms for integrating over total volume")

report(integral(Tp,"ALL"))

report(integral(Tp))

report '-----'

report("Compare various forms for integrating over surface of region 2")

report '-----'

report("Compare surface flux on region 2 to internal divergence integral")

report(integral(Q,"Inner Region"))

report '-----'

report("Compare surface flux on total volume to internal divergence integral")