AnnularGap

model AnnularGap "Annular Gap"
    import HydraulicsByFluidon.Media.Base.FluidInterface;
    import Modelica.Units.SI;

    parameter SI.Length Diameter(min = 0, displayUnit = "mm") = 0.005 "Outer diameter";
    parameter SI.Length GapHeightA(min = 0, displayUnit = "mum") = 1e-4 "Gap Height A";
    parameter SI.Length GapHeightB(min = 1e-6, displayUnit = "mum") = 1e-4 "Gap Heigt B";
    parameter SI.Length Length(displayUnit = "mm") = 0.1 "Length";
    parameter SI.DimensionlessRatio relEccentricity(min = 0, max = 1, displayUnit = "%") = 0 "Eccentricity ratio";

    extends HydraulicsByFluidon.Components.Base.PartialResistorBase;

protected
    Real pMid;
    Real lambda;
    Real minGapHeight;
initial equation
    assert(0 < GapHeightA, "Gap Height B must be > 0");
    assert(0 < GapHeightB, "Gap Height A must be > 0");
equation
    lambda = minGapHeight / max(GapHeightA, GapHeightB);
    pMid = 0.5 * (fluidPortA.p + fluidPortB.p);
    minGapHeight = min(GapHeightA, GapHeightB);
    fluidPortB.mFlow = Modelica.Constants.pi * Diameter * minGapHeight ^ 3 / (12 * Length * FluidInterface.calcNu(fluidPortA.fluidId, pMid, fluidPortA.fluidTemperature)) * (2 * lambda ^ 2 / (1 + lambda) + (1 + lambda) * (0.75) * relEccentricity ^ 2) * dp;

    annotation (
        Icon(graphics = {
            Rectangle(
                fillColor = {255, 255, 255},
                fillPattern = FillPattern.Solid,
                extent = {
                    {-30, 60}, 
                    {30, -60}}), 
            Polygon(
                fillColor = {200, 200, 200},
                fillPattern = FillPattern.Solid,
                points = {
                    {-20, 60}, 
                    {-14, -60}, 
                    {14, -60}, 
                    {20, 60}, 
                    {-20, 60}}), 
            Text(
                origin = {0, -42},
                textColor = {0, 0, 255},
                extent = {
                    {-78, -20}, 
                    {78, 20}},
                textString = "A"), 
            Text(
                origin = {0, 42},
                textColor = {0, 0, 255},
                extent = {
                    {-78, -20}, 
                    {78, 20}},
                textString = "B")}),
        Documentation(info = "<html>\r\r\r\r\r\n            <p>\r\r\r\r\r\n                The component AnnularOrifice is a model of a flow resistance of a fully-developed laminar flow in the gap of a circular tube with an insert.\r\r\r\r\r\n                The insert can be located off-center from the tube by the <var>Eccentricity ratio</var>.\r\r\r\r\r\n            </p>\r\r\r\r\r\n            <p>\r\r\r\r\r\n                <center><img align=\"middle\" src=\"modelica://HydraulicsByFluidon/Resources/Images/Components/Resistors/AnnularOrifice.png\"></center>\r\r\r\r\r\n            </p>\r\r\r\r\r\n            <p>\r\r\r\r\r\n                The <var>Eccentricity ratio</var> is defined by\r\r\r\r\r\n            </p>\r\r\r\r\r\n            <p>\r\r\r\r\r\n                <var>Eccentricity ratio</var> = eccentricity / min(<var>Gap Height A</var>, <var>Gap Height B</var>), 0 <= <var>Eccentricity ratio</var> <= 1\r\r\r\r\r\n            </p></html>"));
end AnnularGap;