Convection

model Convection "Lumped thermal element for heat convection (Q_flow = Gc*dT)"
    Modelica.SIunits.HeatFlowRate Q_flow "Heat flow rate from solid -> fluid";
    Modelica.SIunits.TemperatureDifference dT "= solid.T - fluid.T";
    Modelica.Blocks.Interfaces.RealInput Gc(unit = "W/K") "Signal representing the convective thermal conductance in [W/K]"
        annotation (Placement(transformation(
            origin = {0, 100},
            extent = {
                {-20, -20}, 
                {20, 20}},
            rotation = 270)));
    Interfaces.HeatPort_a solid annotation (Placement(transformation(extent = {
        {-110, -10}, 
        {-90, 10}})));
    Interfaces.HeatPort_b fluid annotation (Placement(transformation(extent = {
        {90, -10}, 
        {110, 10}})));
equation
    Q_flow = Gc * dT;
    dT = solid.T - fluid.T;
    fluid.Q_flow = -Q_flow;
    solid.Q_flow = Q_flow;

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Rectangle(
                    extent = {
                        {-62, 80}, 
                        {98, -80}},
                    lineColor = {255, 255, 255},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Rectangle(
                    extent = {
                        {-90, 80}, 
                        {-60, -80}},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Backward), 
                Text(
                    extent = {
                        {-150, -90}, 
                        {150, -130}},
                    textString = "%name",
                    lineColor = {0, 0, 255}), 
                Line(
                    points = {
                        {100, 0}, 
                        {100, 0}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {-60, 20}, 
                        {76, 20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {-60, -20}, 
                        {76, -20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {-34, 80}, 
                        {-34, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {6, 80}, 
                        {6, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {40, 80}, 
                        {40, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {76, 80}, 
                        {76, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {-34, -80}, 
                        {-44, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {-34, -80}, 
                        {-24, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {6, -80}, 
                        {-4, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {6, -80}, 
                        {16, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {40, -80}, 
                        {30, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {40, -80}, 
                        {50, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {76, -80}, 
                        {66, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {76, -80}, 
                        {86, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {56, -30}, 
                        {76, -20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {56, -10}, 
                        {76, -20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {56, 10}, 
                        {76, 20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {56, 30}, 
                        {76, 20}},
                    color = {191, 0, 0}), 
                Text(
                    extent = {
                        {22, 124}, 
                        {92, 98}},
                    textString = "Gc")}),
        Documentation(info = "<html>\n<p>\nThis is a model of linear heat convection, e.g., the heat transfer between a plate and the surrounding air; see also:\n<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.ConvectiveResistor\">ConvectiveResistor</a>.\nIt may be used for complicated solid geometries and fluid flow over the solid by determining the\nconvective thermal conductance Gc by measurements. The basic constitutive equation for convection is\n</p>\n<pre>\n   Q_flow = Gc*(solid.T - fluid.T);\n   Q_flow: Heat flow rate from connector 'solid' (e.g., a plate)\n      to connector 'fluid' (e.g., the surrounding air)\n</pre>\n<p>\nGc = G.signal[1] is an input signal to the component, since Gc is\nnearly never constant in practice. For example, Gc may be a function\nof the speed of a cooling fan. For simple situations,\nGc may be <em>calculated</em> according to\n</p>\n<pre>\n   Gc = A*h\n   A: Convection area (e.g., perimeter*length of a box)\n   h: Heat transfer coefficient\n</pre>\n<p>\nwhere the heat transfer coefficient h is calculated\nfrom properties of the fluid flowing over the solid. Examples:\n</p>\n<p>\n<strong>Machines cooled by air</strong> (empirical, very rough approximation according\nto R. Fischer: Elektrische Maschinen, 10th edition, Hanser-Verlag 1999,\np. 378):\n</p>\n<pre>\n    h = 7.8*v^0.78 [W/(m2.K)] (forced convection)\n      = 12         [W/(m2.K)] (free convection)\n    where\n      v: Air velocity in [m/s]\n</pre>\n<p><strong>Laminar</strong> flow with constant velocity of a fluid along a\n<strong>flat plate</strong> where the heat flow rate from the plate\nto the fluid (= solid.Q_flow) is kept constant\n(according to J.P.Holman: Heat Transfer, 8th edition,\nMcGraw-Hill, 1997, p.270):\n</p>\n<pre>\n   h  = Nu*k/x;\n   Nu = 0.453*Re^(1/2)*Pr^(1/3);\n   where\n      h  : Heat transfer coefficient\n      Nu : = h*x/k       (Nusselt number)\n      Re : = v*x*rho/mue (Reynolds number)\n      Pr : = cp*mue/k    (Prandtl number)\n      v  : Absolute velocity of fluid\n      x  : distance from leading edge of flat plate\n      rho: density of fluid (material constant\n      mue: dynamic viscosity of fluid (material constant)\n      cp : specific heat capacity of fluid (material constant)\n      k  : thermal conductivity of fluid (material constant)\n   and the equation for h holds, provided\n      Re &lt; 5e5 and 0.6 &lt; Pr &lt; 50\n</pre>\n</html>"),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Rectangle(
                    extent = {
                        {-90, 80}, 
                        {-60, -80}},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Backward), 
                Line(
                    points = {
                        {100, 0}, 
                        {100, 0}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {100, 0}, 
                        {100, 0}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {100, 0}, 
                        {100, 0}},
                    color = {0, 127, 255}), 
                Text(
                    extent = {
                        {-40, 40}, 
                        {80, 20}},
                    lineColor = {255, 0, 0},
                    textString = "Q_flow"), 
                Line(
                    points = {
                        {-60, 20}, 
                        {76, 20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {-60, -20}, 
                        {76, -20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {-34, 80}, 
                        {-34, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {6, 80}, 
                        {6, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {40, 80}, 
                        {40, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {76, 80}, 
                        {76, -80}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {-34, -80}, 
                        {-44, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {-34, -80}, 
                        {-24, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {6, -80}, 
                        {-4, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {6, -80}, 
                        {16, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {40, -80}, 
                        {30, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {40, -80}, 
                        {50, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {76, -80}, 
                        {66, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {76, -80}, 
                        {86, -60}},
                    color = {0, 127, 255}), 
                Line(
                    points = {
                        {56, -30}, 
                        {76, -20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {56, -10}, 
                        {76, -20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {56, 10}, 
                        {76, 20}},
                    color = {191, 0, 0}), 
                Line(
                    points = {
                        {56, 30}, 
                        {76, 20}},
                    color = {191, 0, 0})}));
end Convection;