Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vacuum dec2023 #179

Merged
merged 8 commits into from
Sep 23, 2024
74 changes: 55 additions & 19 deletions src/Tarcog/src/EffectiveOpenness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,41 @@ namespace EffectiveLayers
Ah(ah), Dl(dl), Dr(dr), Dtop(dtop), Dbot(dbot)
{}

EffectiveOpenness::EffectiveOpenness(const double ah,
EffectiveOpenness::EffectiveOpenness(const double effectiveFrontThermalOpennessArea,
const double al,
const double ar,
const double atop,
const double abot,
const double frontPorosity) :
Ah(ah), Al(al), Ar(ar), Atop(atop), Abot(abot), FrontPorosity(frontPorosity)
EffectiveFrontThermalOpennessArea(effectiveFrontThermalOpennessArea),
Al(al),
Ar(ar),
Atop(atop),
Abot(abot),
PermeabilityFactor(frontPorosity)
{}

bool isClosed(const EffectiveOpenness & effectiveOpenness)
{
return effectiveOpenness.Ah == 0.0 && effectiveOpenness.Al == 0.0
&& effectiveOpenness.Ar == 0.0 && effectiveOpenness.Atop == 0.0
&& effectiveOpenness.Abot == 0.0 && effectiveOpenness.FrontPorosity == 0.0;
return effectiveOpenness.EffectiveFrontThermalOpennessArea == 0.0
&& effectiveOpenness.Al == 0.0 && effectiveOpenness.Ar == 0.0
&& effectiveOpenness.Atop == 0.0 && effectiveOpenness.Abot == 0.0
&& effectiveOpenness.PermeabilityFactor == 0.0;
}

EffectiveLayer::EffectiveLayer(double width,
double height,
double thickness,
const ShadeOpenness & openness,
const Coefficients & coefficients) :
const Coefficients & coefficients,
double permeabilityFactor) :
m_Width(width),
m_Height(height),
m_Thickness(thickness),
m_ShadeOpenness(
openness.Ah * width * height, openness.Dl, openness.Dr, openness.Dtop, openness.Dbot),
coefficients{coefficients}
coefficients(coefficients),
m_PermeabilityFactor(permeabilityFactor)
{}

Coefficients::Coefficients(double c1, double c2, double c3, double c4) :
Expand Down Expand Up @@ -95,11 +103,35 @@ namespace EffectiveLayers
width, height, thickness, slatAngle, slatWidth, openness, {0.041, 0.0, 0.27, 0.012})
{}

EffectiveLayerLinearPermeability::EffectiveLayerLinearPermeability(
double width, double height, double thickness, const ShadeOpenness & openness) :
EffectiveLayer(width, height, thickness, openness, {0.078, 1.2, 1.0, 1.0})
{}

EffectiveOpenness EffectiveLayerLinearPermeability::getEffectiveOpenness()
{
const auto area{m_Width * m_Height};
const auto Ah_eff{area * coefficients.C1
* (std::pow(m_ShadeOpenness.Ah / area, coefficients.C2))};
const auto Al_eff{m_ShadeOpenness.Dl * m_Height * coefficients.C3};
const auto Ar_eff{m_ShadeOpenness.Dr * m_Height * coefficients.C3};
const auto Atop_eff{m_ShadeOpenness.Dtop * m_Width * coefficients.C4};
const auto Abop_eff{m_ShadeOpenness.Dbot * m_Width * coefficients.C4};
return {Ah_eff, Al_eff, Ar_eff, Atop_eff, Abop_eff, m_ShadeOpenness.Ah / area};
}

double EffectiveLayerLinearPermeability::effectiveThickness()
{
return m_Thickness;
}

EffectiveLayerCommonType::EffectiveLayerCommonType(double width,
double height,
double thickness,
const ShadeOpenness & openness) :
EffectiveLayer(width, height, thickness, openness, {0.078, 1.2, 1.0, 1.0})
const ShadeOpenness & openness,
double permeabilityFactor) :
EffectiveLayer(
width, height, thickness, openness, {0.078, 1.2, 1.0, 1.0}, permeabilityFactor)
{}

EffectiveOpenness EffectiveLayerCommonType::getEffectiveOpenness()
Expand All @@ -111,7 +143,7 @@ namespace EffectiveLayers
const auto Ar_eff{m_ShadeOpenness.Dr * m_Height * coefficients.C3};
const auto Atop_eff{m_ShadeOpenness.Dtop * m_Width * coefficients.C4};
const auto Abop_eff{m_ShadeOpenness.Dbot * m_Width * coefficients.C4};
return {Ah_eff, Al_eff, Ar_eff, Atop_eff, Abop_eff, m_ShadeOpenness.Ah};
return {Ah_eff, Al_eff, Ar_eff, Atop_eff, Abop_eff, m_PermeabilityFactor};
}

double EffectiveLayerCommonType::effectiveThickness()
Expand All @@ -123,35 +155,39 @@ namespace EffectiveLayers
double height,
double thickness,
const ShadeOpenness & openness) :
EffectiveLayerCommonType(width, height, thickness, openness)
EffectiveLayerLinearPermeability(width, height, thickness, openness)
{}

EffectiveLayerDiffuse::EffectiveLayerDiffuse(double width,
double height,
double thickness,
const ShadeOpenness & openness) :
EffectiveLayerCommonType(width, height, thickness, openness)
const ShadeOpenness & openness,
double permeabilityFactor) :
EffectiveLayerCommonType(width, height, thickness, openness, permeabilityFactor)
{}

EffectiveLayerWoven::EffectiveLayerWoven(double width,
double height,
double thickness,
const ShadeOpenness & openness) :
EffectiveLayerCommonType(width, height, thickness, openness)
EffectiveLayerLinearPermeability(width, height, thickness, openness)
{}

EffectiveLayerBSDF::EffectiveLayerBSDF(double width,
double height,
double thickness,
const ShadeOpenness & openness) :
EffectiveLayerCommonType(width, height, thickness, openness)
const ShadeOpenness & openness,
double permeabilityFactor) :
EffectiveLayerCommonType(width, height, thickness, openness, permeabilityFactor)
{}

EffectiveLayerOther::EffectiveLayerOther(double width,
double height,
double thickness,
const ShadeOpenness & openness) :
EffectiveLayer(width, height, thickness, openness)
const ShadeOpenness & openness,
double permeabilityFactor) :
EffectiveLayer(
width, height, thickness, openness, Coefficients(0, 0, 0, 0), permeabilityFactor)
{}

EffectiveOpenness EffectiveLayerOther::getEffectiveOpenness()
Expand All @@ -161,7 +197,7 @@ namespace EffectiveLayers
m_ShadeOpenness.Dr * m_Height,
m_ShadeOpenness.Dtop * m_Width,
m_ShadeOpenness.Dbot * m_Width,
m_ShadeOpenness.Ah};
m_PermeabilityFactor};
}

double EffectiveLayerOther::effectiveThickness()
Expand Down
57 changes: 42 additions & 15 deletions src/Tarcog/src/EffectiveOpenness.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,28 @@ namespace EffectiveLayers

//! \brief Effective frontOpenness of shading layer that is necessary for thermal calculations.
//!
//! Thermal frontOpenness of shading layer will not match physical frontOpenness and because of
//! that some calculations are required.
//!
struct EffectiveOpenness
{
EffectiveOpenness(
double ah, double al, double ar, double atop, double abot, double frontPorosity);

double Ah;
EffectiveOpenness(double effectiveFrontThermalOpennessArea,
double al,
double ar,
double atop,
double abot,
double frontPorosity);

//!< Effective openness of the layer for thermal calculations between the gaps
double EffectiveFrontThermalOpennessArea;
//!< Area of the left side openness where the air is flowing between the gaps
double Al;
//!< Area of the right side openness where the air is flowing between the gaps
double Ar;
//!< Area of the top side openness where the air is flowing between the gaps
double Atop;
//!< Area of the bottom side openness where the air is flowing between the gaps
double Abot;
// Geometrical openness used to calculate equivalent layer conductivity
double FrontPorosity;
double PermeabilityFactor;
};

bool isClosed(const EffectiveOpenness & effectiveOpenness);
Expand All @@ -55,7 +63,8 @@ namespace EffectiveLayers
double height,
double thickness,
const ShadeOpenness & openness,
const Coefficients & coefficients = {0.0, 0.0, 0.0, 0.0});
const Coefficients & coefficients = {0.0, 0.0, 0.0, 0.0},
double permeabilityFactor = 0.0);

virtual EffectiveOpenness getEffectiveOpenness() = 0;

Expand All @@ -69,6 +78,8 @@ namespace EffectiveLayers
ShadeOpenness m_ShadeOpenness;

Coefficients coefficients;

double m_PermeabilityFactor;
};

class EffectiveVenetian : public EffectiveLayer
Expand Down Expand Up @@ -112,20 +123,33 @@ namespace EffectiveLayers
double slatWidth);
};

//! \brief Used for effective calculations for Perforated, Woven, Diffuse shade and BSDF
//! \brief Used for effective calculations where permeability is linear with frontOpenness Ah
class EffectiveLayerLinearPermeability : public EffectiveLayer
{
public:
EffectiveLayerLinearPermeability(double width,
double height,
double thickness,
const ShadeOpenness & openness);

EffectiveOpenness getEffectiveOpenness() override;
double effectiveThickness() override;
};

class EffectiveLayerCommonType : public EffectiveLayer
{
public:
EffectiveLayerCommonType(double width,
double height,
double thickness,
const ShadeOpenness & openness);
const ShadeOpenness & openness,
double permeabilityFactor);

EffectiveOpenness getEffectiveOpenness() override;
double effectiveThickness() override;
};

class EffectiveLayerPerforated : public EffectiveLayerCommonType
class EffectiveLayerPerforated : public EffectiveLayerLinearPermeability
{
public:
EffectiveLayerPerforated(double width,
Expand All @@ -140,10 +164,11 @@ namespace EffectiveLayers
EffectiveLayerDiffuse(double width,
double height,
double thickness,
const ShadeOpenness & openness);
const ShadeOpenness & openness,
double permeabilityFactor);
};

class EffectiveLayerWoven : public EffectiveLayerCommonType
class EffectiveLayerWoven : public EffectiveLayerLinearPermeability
{
public:
EffectiveLayerWoven(double width,
Expand All @@ -158,7 +183,8 @@ namespace EffectiveLayers
EffectiveLayerBSDF(double width,
double height,
double thickness,
const ShadeOpenness & openness);
const ShadeOpenness & openness,
double permeabilityFactor);
};

class EffectiveLayerOther : public EffectiveLayer
Expand All @@ -167,7 +193,8 @@ namespace EffectiveLayers
EffectiveLayerOther(double width,
double height,
double thickness,
const ShadeOpenness & openness);
const ShadeOpenness & openness,
double permeabilityFactor);

EffectiveOpenness getEffectiveOpenness() override;
double effectiveThickness() override;
Expand Down
4 changes: 2 additions & 2 deletions src/Tarcog/src/Layers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ namespace Tarcog::ISO15099::Layers
effectiveOpenness.Abot,
effectiveOpenness.Al,
effectiveOpenness.Ar,
effectiveOpenness.Ah,
effectiveOpenness.FrontPorosity),
effectiveOpenness.EffectiveFrontThermalOpennessArea,
effectiveOpenness.PermeabilityFactor),
std::make_shared<Surface>(frontEmissivity, frontIRTransmittance),
std::make_shared<Surface>(backEmissivity, backIRTransmittance));
}
Expand Down
59 changes: 35 additions & 24 deletions src/Tarcog/src/PermeabilityFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,40 +51,51 @@ namespace ThermalPermeability
return curvature;
}

double frontOpenness(const double t_TiltAngle,
const double t_SlatSpacing,
const double t_MatThickness,
const double t_SlatCurvature,
const double t_SlatWidth)
double frontOpenness(const double tiltAngle,
const double slatSpacing,
const double matThickness,
const double slatCurvature,
const double slatWidth)
{
const auto aRise{calculateRise(t_SlatCurvature, t_SlatWidth)};
const auto h{aRise > 1e-6 ? aRise : 1e-6};
const auto temp{h + pow(t_SlatWidth, 2) / (4 * h)};
const auto Ls{asin(t_SlatWidth / temp) * temp};
const auto angleMax{maxAngle(t_SlatSpacing, t_MatThickness)};
const auto slatAngle{std::fmin(std::abs(t_TiltAngle), angleMax)};

double cosPhi = std::cos(slatAngle * ConstantsData::WCE_PI / 180);
double sinPhi = std::sin(std::abs(slatAngle) * ConstantsData::WCE_PI / 180);
if((slatAngle == 90) || (slatAngle == -90))
cosPhi = 0;
auto opennessFactor{
1
- (t_MatThickness * Ls)
/ ((Ls * cosPhi + t_MatThickness * sinPhi) * (t_SlatSpacing + t_MatThickness))};
// Calculate rise based on slat curvature and width
const auto rise = calculateRise(slatCurvature, slatWidth);
const auto effectiveRise = (rise > 1e-6) ? rise : 1e-6;

// Calculate the length of slat arc (Ls)
const auto temp = effectiveRise + pow(slatWidth, 2) / (4 * effectiveRise);
const auto slatArcLength = asin(slatWidth / temp) * temp;

// Determine the maximum allowable angle and the effective slat angle
const auto effectiveSlatAngle =
std::fmin(std::abs(tiltAngle), maxAngle(slatSpacing, matThickness));

// Handle special cases where slat angle is 90 degrees
const double adjustedCosPhi =
(effectiveSlatAngle == 90 || effectiveSlatAngle == -90)
? 0
: std::cos(FenestrationCommon::radians(effectiveSlatAngle));

// Compute the openness factor
auto opennessFactor =
1.0 - (matThickness * slatArcLength) / ((slatArcLength * adjustedCosPhi +
matThickness * std::sin(FenestrationCommon::radians(effectiveSlatAngle))) * (slatSpacing + matThickness));

// Ensure openness factor is non-negative
if(opennessFactor < 0)
opennessFactor = 0;

return opennessFactor;
}

} // namespace Venetian

namespace Perforated
{
double frontOpenness(Type t_Type,
double t_SpacingX,
double t_SpacingY,
double t_DimensionX,
double t_DimensionY)
double t_SpacingX,
double t_SpacingY,
double t_DimensionX,
double t_DimensionY)
{
const auto cellArea{t_SpacingX * t_SpacingY};
std::map<Type, std::function<double(const double, const double)>> opennessFraction{
Expand Down
4 changes: 3 additions & 1 deletion src/Tarcog/tst/units/DoubleClearIndoorShadeAir.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ class TestDoubleClearIndoorShadeAir : public testing::Test
auto dleft = 0.1;
auto dright = 0.1;
auto Afront = 0.2;
auto PermeabilityFactor = 0.2;

EffectiveLayers::ShadeOpenness openness{Afront, dleft, dright, dtop, dbot};

auto windowWidth = 1.0;
auto windowHeight = 1.0;

EffectiveLayers::EffectiveLayerOther effectiveLayer{
windowWidth, windowHeight, shadeLayerThickness, openness};
windowWidth, windowHeight, shadeLayerThickness, openness, PermeabilityFactor};

auto layer3 = Tarcog::ISO15099::Layers::shading(
shadeLayerThickness, shadeLayerConductance, effectiveLayer.getEffectiveOpenness());
Expand Down
3 changes: 2 additions & 1 deletion src/Tarcog/tst/units/DoubleClearOutdoorShadeAir.unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ class TestDoubleClearOutdoorShadeAir : public testing::Test
auto dleft = 0.1;
auto dright = 0.1;
auto Afront = 0.2;
auto PermeabilityFactor = 0.2;

EffectiveLayers::ShadeOpenness openness{Afront, dleft, dright, dtop, dbot};

double windowWidth = 1;
double windowHeight = 1;

EffectiveLayers::EffectiveLayerOther effectiveLayer{
windowWidth, windowHeight, shadeLayerThickness, openness};
windowWidth, windowHeight, shadeLayerThickness, openness, PermeabilityFactor};

auto layer1 = Tarcog::ISO15099::Layers::shading(
shadeLayerThickness, shadeLayerConductance, effectiveLayer.getEffectiveOpenness());
Expand Down
Loading
Loading