Hello again,

First of all, thank you for your help with my previous problem.
I have been building on the problem and have run into some trouble in
defining a more complex geometry.

Here is a quick overview:
I am still looking at the transient conduction through a material where the
thermal conductivity of that material changes as a function of the
temperature. My previous post was just looking at a simple 1D problem (just
straight conduction through a slab of the material). Now I would like to
look at it in 3D cylindrical coordinates. We have an insulated 1.5m long
pipe with an inner and outer radius of 0.0046m and 0.00635m respectively.
So I am only concerned with what happens between these radii, not with
anything from the inner radius to the center of the pipe.

I have tried to set up a 3D mesh using Gmsh, but have not been very
successful. Could anyone offer some insight as to how I can set this up
successfully?

Thank you very much in advance for your help!

###########

from fipy import *

# 3D Cylindrical Mesh in Gmsh
# Is there a cylindrical 3D mesh option for FiPy that might be easier to
use?
r = 0.0023         # inner radius of pipe
R = 0.003175    # outer radius of pipe
length = 1.5      # length of test section (z coordinate)
cl = 0.0001       # characteristic length

mesh = GmshImporter3D('''
            r = %(r)g;                  # are the first 4 lines here
necessary?
            R = %(R)g;
            length = %(length)g;
            cl = %(cl)g;
            Point(1) = {0, 0, 0, cl};
            Point(2) = {R, 0, 0, cl};
            Point(3) = {0, R, 0, cl};
            Point(4) = {-R, 0, 0, cl};
            Point(5) = {0, -R, 0, cl};
            Point(6) = {r, 0, 0, cl};
            Point(7) = {0, r, 0, cl};
            Point(8) = {-r, 0, 0, cl};
            Point(9) = {0, -r, 0, cl};
            Circle(11) = {3,1,4};
            Circle(12) = {4,1,5};
            Circle(13) = {5,1,2};
            Circle(14) = {2,1,3};
            Circle(15) = {7,1,8};
            Circle(16) = {8,1,9};
            Circle(17) = {9,1,6};
            Circle(18) = {6,1,7};
            Line(19) = {7,3};
            Line(20) = {9,5};

            # The following was adapted from an example I found where you
make 2 surfaces on the cross section of the
            # pipe (shaped like a C and a backwards C), then connect and
extrude them
            # Is that a common way to do something like this?
            Line Loop(21) = {19,11,12,-20,-16,-15};
            Plane Surface(22) = {21};
            Line Loop(23) = {20,13,14,-19,-18,-7};
            Plane Surface(24) = {23};

            Transfinite Line{11:18} = 6/2;
            Transfinite Line{19,20} = 6;
            Transfinite Surface{22,24} = {23,24,22,21};
            Recombine Surface '*';

            Extrude{0,0,length}{Surface{22,24}; Layers{4,1}; Recombine};
            ''' % locals())             # I am not 100% sure what the
purpose of 'locals' is. Is it needed?

# Definitions:
omega = 0.00164
k0 = 11.83
temp = CellVariable(name = 'Temperature', mesh=mesh, hasOld=1)
therm_cond = k0 * numerix.exp(omega * temp)
therm_cond.name = 'Thermal Conductivity'

# Boundary Conditions
rFlux = [100]
RFlux = [0]
rTemp = 150
RTemp = 250
BCs = (FixedFlux(faces=mesh.getExteriorFaces(), value=RFlux),\      # is
this the correct way to represent the

# outer radius BCs?
       FixedValue(faces=mesh.getInteriorFaces(), value=rTemp),)        #
and the inner radius ones?

eq = TransientTerm() == DiffusionTerm(coeff=therm_cond)

# Solving equation
elapsedTime = 0
totalElapsedTime = 300
timeStep = 1
desiredResidual = 0.0001

if __name__ == '__main__':
    Tviewer = Viewer(vars=temp)
    kviewer = Viewer(vars=therm_cond)
    meshviewer = Viewer(vars=temp)
    meshviewer.plot()       # I would really like to be able to view the
mesh on its own to satisfy myself that it is
                                    # exactly how I want it
                                    # I don't think this method is correct,
could you suggest a better way?

while elapsedTime < totalElapsedTime:
    temp.updateOld()
    residual = 1e100
    while residual > desiredResidual:
        residual = eq.sweep(var=temp, boundaryConditions=BCs, dt=timeStep)
    elapsedTime += timeStep

# Plot results:
if __name__ == '__main__':
    Tviewer.plot()
    kviewer.plot()
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to