18using namespace helios;
22 wind_speed_default = 1.f;
24 air_temperature_default = 293.f;
26 surface_temperature_default = 303.f;
48 std::vector<uint> UUIDs{UUID};
56 if (strcmp(gH_model,
"Pohlhausen") == 0 || strcmp(gH_model,
"Polhausen") == 0) {
58 }
else if (strcmp(gH_model,
"InclinedPlate") == 0) {
60 }
else if (strcmp(gH_model,
"Sphere") == 0) {
62 }
else if (strcmp(gH_model,
"Ground") == 0) {
65 std::cerr <<
"WARNING (EnergyBalanceModel::setBoundaryLayerModel): Boundary-layer conductance model " << gH_model <<
" is unknown. Skipping this function call.." << std::endl;
69 for (
uint UUID: UUIDs) {
70 boundarylayer_model[UUID] = model;
81 for (
uint UUID: UUIDs) {
87 U = wind_speed_default;
94 Ta = air_temperature_default;
101 T = surface_temperature_default;
119 char Nsides = (twosided_flag == 0) ? 1 : 2;
124 float gH = calculateBoundaryLayerConductance(boundarylayer_model[UUID], U, L, Nsides, inclination, T, Ta);
130float BLConductanceModel::calculateBoundaryLayerConductance(
uint gH_model,
float U,
float L,
char Nsides,
float inclination,
float TL,
float Ta) {
133 assert(gH_model < 4);
145 gH = 0.135f * sqrt(U / L) * float(Nsides);
147 }
else if (gH_model == 1) {
152 float alpha = nu / Pr;
154 float Re = U * L / nu;
156 float Gr = 9.81f * fabs(TL - Ta) * std::pow(L, 3) / ((Ta) *nu * nu);
159 if (U <= 1e-6f || Re <= 1e-6f) {
162 if (inclination < 75.f * M_PI / 180.f || inclination > 105.f *
M_PI / 180.f) {
164 Nu_free = 0.54f * std::pow(Gr * fabs(cos(inclination)), 0.25f);
167 Nu_free = 0.59f * std::pow(Gr, 0.25f);
169 gH = Nu_free * (alpha / L);
173 float F1 = 0.399f * std::pow(Pr, 1.f / 3.f) * pow(1.f + pow(0.0468f / Pr, 2.f / 3.f), -0.25f);
174 float F2 = 0.75f * std::pow(Pr, 0.5f) * pow(2.5f * (1.f + 2.f * pow(Pr, 0.5f) + 2.f * Pr), -0.25f);
177 float free_direction;
186 if (inclination < 75.f * M_PI / 180.f || inclination > 105.f *
M_PI / 180.f) {
188 gH = 41.4f * alpha / L * 2.f * F1 * sqrtf(Re) * std::pow(1.f + free_direction * std::pow(2.f * F2 * std::pow(Gr * fabs(cos(inclination)) / (Re * Re), 0.25f) / (3.f * F1), 3), 1.f / 3.f);
192 float C = 0.07f * sqrtf(fabs(cos(inclination)));
193 float F3 = std::pow(Pr, 0.5f) * std::pow(0.25f + 1.6f * std::pow(Pr, 0.5f), -1.f) * std::pow(Pr / 5.f, 1.f / 5.f + C);
195 gH = 41.4f * alpha / L * 2.f * F1 * sqrtf(Re) * std::pow(1.f + free_direction * std::pow((F3 * pow(Gr * pow(Re, -5.f / 2.f), 1.f / 5.f) * std::pow(Gr, C)) / (6.f * (1.f / 5.f + C) * F1), 3.f), 1.f / 3.f);
198 }
else if (gH_model == 2) {
207 float Re = U * L / nu;
209 gH = (ka / cp) / L * (2.0 + 0.6 * sqrtf(Re) * pow(Pr, 1.f / 3.f));
211 }
else if (gH_model == 3) {
214 gH = 0.004f + 0.012f * U;