In a simple 2D heat conduction problem I try to impose a power flux on
part of the outer boundary and a fixed temperature on the remaining
part.

However the resulting temperature distribution is not what I expect and
furthermore depends on how the problem geometry is rotated (alphadeg : I
did this to try and understand what is happening).

To impose the powerflux I use the method described in
http://matforge.org/fipy/wiki/BoundaryConditions.

fipy.__version__ is 3.0

Can you tell me what I'm doing wrong ?



"""
use FiPy for a simple case

1) semi circle on which there is a power flux
   (uniform ortogonal to the surface)
   
2) base of the semi circle at fixed temperature

F. Durodie 29 April 2013
"""

import fipy as fp

print fp.__version__

# setup domain

radius = 0.05                               # [m]
cellSize = radius/20                        # [m]
angledeg = -150           # [degree] rotate the geometry
                          #(no influence expected)

angle    = angledeg * fp.numerix.pi/180.    # [rad]
geo = """
        cellSize = %(cellSize)g;
        radius   = %(radius)g;
        angle    = %(angle)g;

        // center of semi circle
        Point(1) = { 0, 0, 0, cellSize};
         
        // base line
        Point(2) = {   radius * Cos(angle),    radius * Sin(angle), 0,
cellSize};
        Point(3) = { - radius * Cos(angle),  - radius * Sin(angle), 0,
cellSize};

        // boundaries
        Circle(1) = { 2, 1, 3};
        Line(2)   = { 3, 2};

        // domains
        Line Loop(1) = {1,2};
        Plane Surface(1) = {1};

        Physical Surface("problem")  = {1};
        Physical Line("base")      = {2};
        Physical Line("semi circle") = {1};         
      """ % locals()

mesh = fp.Gmsh2D(geo)

# physics parameters
K = 15.           # W/(m.K)
PowerFlux = 100E3 # [W/m2]

# create variable
T = fp.CellVariable(name = "Temperature" , mesh = mesh, value =  0.)

# isothermal boundary condition
T.constrain(0., where=mesh.physicalFaces["base"])

# power flux on "semi cercle" boundary imposed as a temperature gradient
# on the semi circular boundary : Ps [W/m2] / K [W/(m.K)] = |grad T|
[K/m]
# reference http://matforge.org/fipy/wiki/BoundaryConditions
T.getFaceGrad().constrain(PowerFlux/K,where=mesh.physicalFaces["semi
circle"])

# solve steady state equation
fp.DiffusionTerm(coeff=K).solve(var=T)

# plot results
view_T = fp.MatplotlibViewer(vars=T)
view_T.plot('test_FiPy_7_Temperature.png')


_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to