Dear all,
I think everyone here knows what an insulated pipeline is: a pipe composedof an 
inner metallic tube covered by a layer of elastomer or any otherinsulating 
material. The inner tube and the insulation obviously have different thermal 
diffusivities but their thicknesses may or may not be the same (they usually 
aren't).
I found a script in this FiPy list which I adapted to a single-layer 
pipesection (2D radial geometry), attached to this note. Easy. Now I'm tryingto 
add a second layer, the insulation. I have the following lines:
     eqn = fipy.TransientTerm() == fipy.ImplicitDiffusionTerm(coeff=D)
    X, Y = mesh.faceCenters
    innerWall = (mesh.exteriorFaces & (np.sqrt(X**2+Y**2) <= radiusI))    
outerWall = (mesh.exteriorFaces & (np.sqrt(X**2+Y**2) >= radius))
    T.constrain(value=100.0, where=outerWall)    T.constrain(value=300.0, 
where=innerWall)
I think I might add a "midFace" representing the junction or interface between 
the two layers, but:
1.    The temperature in midFace must not be fixed, as it represents 
thetemperature common to both the metallic pipe's outer wall and the 
insulation's inner wall, as the layers are in contact;
2.    I need a second equation "eqn2" to represent the heat transfer throughthe 
insulation layer. I understand that the existing eqn and eqn2 will besimilar in 
their features but they must be coupled. The question is: how?
3.    I also feel that the definitions of innerWall and outerWall are notright, 
but I'm not sure. I'm using an unstructured mesh.
Any help will be much appreciated. Thanks.
Fausto

-- 
To unsubscribe from this group, send email to [email protected]

View this message at https://list.nist.gov/fipy
--- 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
# -*- coding: utf-8 -*-
"""
%________________________________________________________________
% Transferência transiente de calor em geometria radial. Trata-se
% de uma placa circular de raio = 1 m com um orifício concêntrico
% de raio = 1/3 m. Inicialmente (t = 0) a placa encontra-se toda
% a uma temperatura de 0 Celsius. No instante t > 0 a metade
% superior do orifício é aquecida a 225 Celsius enquanto que a
% metade inferior é aquecida a 300 Celsius.
%
% Adaptado de um script de Kyle B. Lawlor <[email protected]>
% publicado na lista FiPy em 04/12/2014.
%
% Fausto Arinos Barbuto, Maio 2021.
%_______________________________________________________________
"""

import fipy
import numpy as np
from matplotlib import pylab as plt

def Grafico(lx=5.25, ly=7.0, sx="", sy=""):
    plt.ion()
    plt.figure(figsize=(lx, ly))
    ax = plt.subplot((111))
    plt.xlabel(sx, fontsize=14)
    plt.ylabel(sy, fontsize=14)
    return ax

if __name__ == '__main__':

    cellSize = 0.025
    radius = 1.0
    radiusI = radius/2.0

    mesh = fipy.Gmsh2D('''cellSize = %(cellSize)g;
            radius = %(radius)g;
            radiusI=%(radiusI)g;
            Point(1) = {0, 0, 0, cellSize};
            Point(2) = {radius, 0, 0, cellSize};
            Point(3) = {0, radius, 0, cellSize};
            Point(5) = {-radius, 0, 0, cellSize};
            Point(6) = {0, -radius, 0, cellSize};
            Circle(1) = {2, 1, 3};
            Circle(2) = {3, 1, 5};
            Circle(3) = {5, 1, 6};
            Circle(4) = {6, 1, 2};
            Line Loop(1) = {1, 2, 3, 4};
            Point(200) = {radiusI, 0, 0, cellSize};
            Point(300) = {0, radiusI, 0, cellSize};
            Point(500) = {-radiusI, 0, 0, cellSize};
            Point(600) = {0,-radiusI, 0, cellSize};
            Circle(100) = {200, 1, 300};
            Circle(200) = {300, 1, 500};
            Circle(300) = {500, 1, 600};
            Circle(400) = {600, 1, 200};
            Line Loop(100) = {100, 200, 300, 400};
            Plane Surface(1)={1,100};
            ''' % locals())

    T = fipy.CellVariable(mesh=mesh, value=0.0, hasOld=True)

    D = 2.5e-03

    eqn = fipy.TransientTerm() == fipy.ImplicitDiffusionTerm(coeff=D)

    X, Y = mesh.faceCenters

    innerWall = (mesh.exteriorFaces & (np.sqrt(X**2+Y**2) <= radiusI))
    outerWall = (mesh.exteriorFaces & (np.sqrt(X**2+Y**2) >= radius))

    T.constrain(value=100.0, where=outerWall)
    T.constrain(value=300.0, where=innerWall)

    timeStepDuration = 1.0
    steps = 40

    ax2 = Grafico(lx=7.0, ly=5.25, sx="X", sy="Y")
    viewer2 = fipy.MatplotlibViewer(vars=(T), xmax=1.0, ymax=1.0, xmin=-1.0, \
                                    ymin=-1.0, axes=ax2)

    for step in range(steps):
        T.updateOld()
        res = 1.0e+10
        while(res >= 1.0e-02):
            res = eqn.sweep(var=(T), dt=timeStepDuration)
        if __name__ == '__main__':
            if(step%10 == 0):
                print("Step: ", step)
            viewer2.plot()

    input("Press ENTER to exit")

Reply via email to