<< Click to Display Table of Contents >> 3d_constraint |
{ 3D_CONSTRAINT.PDE
This problem demonstrates the specification of region-specific CONSTRAINTS in 3D.
This is a modification of problem 3D_BRICKS.PDE.
We apply a constraint on the integral of temperature in a single region/layer compartment.
For validation, we define a check function that has nonzero value only in the selected
compartment and compare its integral to the region-selection form of the integral
statement.
Value boundary conditions are applied, so the solution is unique, so the constraint
acts as a source or sink to maintain the constrained value, we report
the energy lost to the constraining mechanism.
}
title '3D constraint'
coordinates
cartesian3
variables
Tp
definitions
long = 1
wide = 1
K
Q = 10*exp(-x^2-y^2-z^2) { Thermal source }
flag22=0 { build a test function for region 2, layer 2 }
check22 = if flag22>0 then Tp else 0
initial values
Tp = 0.
equations
Tp: div(k*grad(Tp)) + Q = 0
constraints
{ constrain temperature integral in region 2 of layer 2 }
integral(Tp,2,2) = 1
extrusion
surface "bottom" z = -long
layer 'lower'
surface "middle" z=0
layer 'upper'
surface 'top' z= long
boundaries
surface 1 value(Tp)=0 { fix bottom surface temp }
surface 3 value(Tp)=0 { fix top surface temp }
Region 1 { define full domain boundary in base plane }
layer 1 k=1 { bottom right brick }
layer 2 k=0.1 { top right brick }
start(-wide,-wide)
value(Tp) = 0 { fix all side temps }
line to (wide,-wide) { walk outer boundary in base plane }
to (wide,wide)
to (-wide,wide)
to close
Region 2 "Left" { overlay a second region in left half }
layer 1 k=0.2 { bottom left brick }
layer 2 k=0.4 flag22=1 { top left brick }
start(-wide,-wide)
line to (0,-wide) { walk left half boundary in base plane }
to (0,wide)
to (-wide,wide)
to close
monitors
contour(Tp) on surface z=0 as "XY Temp"
contour(Tp) on surface x=0 as "YZ Temp"
contour(Tp) on surface y=0 as "ZX Temp"
elevation(Tp) from (-wide,0,0) to (wide,0,0) as "X-Axis Temp"
elevation(Tp) from (0,-wide,0) to (0,wide,0) as "Y-Axis Temp"
elevation(Tp) from (0,0,-long) to (0,0,long) as "Z-Axis Temp"
plots
contour(Tp) on z=0 as "XY Temp"
contour(Tp) on x=0 as "YZ Temp"
contour(Tp) on y=0 as "ZX Temp"
summary
report("Compare integral forms in region 2 of layer 2 (should be 1.00):")
report(integral(Tp,"Left","Upper"))
report(integral(check22))
report("-----")
report "Constraint acts as an energy sink:"
report(integral(Q)) as "Source Integral "
report(sintegral(normal(-k*grad(Tp)))) as "Surface integral on total outer surface "
report(integral(Q)-sintegral(normal(-k*grad(Tp)))) as "Energy lost to constraint "
end