Dear Fipy users / developer,
I've been exploring fipy during last few days and found it
to be interesting code.
I've a question on the use of boundary condition in fipy.
Here is my problem description:
I built 1D thermal problem where I apply fixed flux BC at left side face
and fixed value temperature at right side face. I found out after simulation
run, the temperature at right side face is slightly different than my BC
specification.
For example, if I set right side BC temperature to be 100 C, and left side
BC flux to
be 1000. The final face temperature is 102.5 C on right side face.
I wonder if the right face temperature value is somewhat interpolated value
?
Command that I use to get right face temperature is
"Temperature.getFaceValue()[-1]"
Below is my code, thanks in advance for your help / comments.
Regards,
Tanto Sugiarto
==================================================================
from fipy import *
k1 = 50.0 # Conductivity of material 1
k2 = 100.0 # Conductivity of material 2
Q = 1000.0 # Heat flux, apply on left side
Tright = 100.0 # Temperature boundary on right side
region1 = Grid1D(dx=1,nx=4)
region2 = Grid1D(dx=0.5,nx=4) + (4.0,)
# Concatenate region1 and reigon2
region3 = region1 + region2
# Apply Boundary Condition
BCs = (FixedFlux(faces=region3.getFacesLeft(),value=Q), \
FixedValue(faces=region3.getFacesRight(),value=Tright))
D = FaceVariable(mesh=region3,value=k1)
x = region3.getFaceCenters()[0]
D.setValue(value=k2,where=(x>4))
# Setup variable
Temperature = CellVariable(name="Soln Variable",mesh=region3,value=0.)
# Setup equation
eq = 0 == ImplicitDiffusionTerm(coeff=D)
# Solve the equation
# Before solving
eq.solve(var=Temperature, boundaryConditions=BCs)
# Get right face temperature
print Temperature.getFaceValue()[-1]
# Get face temperature vector
print Temperature.getFaceValue()
# Get cell temperature vector
print Temperature.getValue()