20#include "../hydrodynamics/PanelLoadLaw.h"
21#include "NetElement3NForces.h"
22#include "NetElementDef.h"
23#include "NetSolidity.h"
26#include <fhsim/ISimObjectLogger.h>
27#include <fhsim/simobject/ISimObjectCreator.h>
33namespace net_panel_setup
39 hydrodynamics::PanelLoadLaw
law;
52inline PanelHydrodynamics ReadPanelHydrodynamics(ISimObjectCreator* creator,
const std::string& structureName)
54 PanelHydrodynamics hydrodynamics {hydrodynamics::ReadPanelLoadLaw(creator), hydrodynamics::ReadFluid(creator)};
55 if (!hydrodynamics::Accepts(hydrodynamics.law, net_element_forces::kFlowReference)) {
56 const std::string message =
"The HydroModel does not accept the free-stream velocity that " + structureName +
" supplies.";
57 creator->ReportParameterError(
"HydroModel", message);
58 throw std::invalid_argument(message);
76 std::string modelName;
77 creator->GetStringParam(
"SolidityModel", modelName,
"MeshOpening");
78 if (!net_solidity::ParseSolidityModel(modelName, rule.
model)) {
79 const std::string message =
"Unknown SolidityModel \"" + modelName +
"\"; expected Fixed or MeshOpening.";
80 creator->ReportParameterError(
"SolidityModel", message);
81 throw std::invalid_argument(message);
83 creator->GetDoubleParam(
"KnotFactor", &rule.
knotFactor, net_solidity::kDefaultKnotFactor);
84 creator->GetDoubleParam(
"Solidity", &solidityParameter, 0.0);
86 const std::string message =
"KnotFactor must be positive, not " + std::to_string(rule.
knotFactor) +
"; the mesh opening solidity would be negative.";
87 creator->ReportParameterError(
"KnotFactor", message);
88 throw std::invalid_argument(message);
90 if (!(solidityParameter >= 0.0 && solidityParameter < 1.0)) {
91 const std::string message =
"Solidity must be in (0, 1), or absent, not " + std::to_string(solidityParameter) +
".";
92 creator->ReportParameterError(
"Solidity", message);
93 throw std::invalid_argument(message);
110 double solidityParameter,
const NetElementDef& panel,
int element, ISimObjectCreator* creator)
113 if (elementRule.
model != net_solidity::SolidityModel::Fixed) {
116 const bool fromSn = panel.
solidity > 0;
117 elementRule.
fixed = fromSn ? panel.
solidity : solidityParameter;
118 if (!(elementRule.
fixed > 0 && elementRule.
fixed < 1)) {
119 const std::string element1 =
"element " + std::to_string(element + 1);
120 const std::string found = fromSn ? element1 +
" has Sn = " + std::to_string(elementRule.
fixed) +
", outside (0, 1)."
121 : (solidityParameter > 0 ? element1 +
" has no Sn, and Solidity = " + std::to_string(solidityParameter) +
" is outside (0, 1)."
122 : element1 +
" has neither.");
123 const std::string message =
"SolidityModel Fixed needs the Solidity parameter or an Sn attribute in (0, 1) on every net element; " + found;
124 creator->ReportParameterError(
"Solidity", message);
125 throw std::invalid_argument(message);
142inline void RequireBarDirections(
bool hasBarDirections,
int element, ISimObjectCreator* creator)
144 if (hasBarDirections) {
147 const std::string message =
"Net panel " + std::to_string(element + 1) +
" has collinear mesh coordinates (zero mesh determinant), so it has no bar directions; every HydroModel needs them.";
148 creator->ReportParameterError(
"HydroModel", message);
149 throw std::invalid_argument(message);
158inline void WarnIfSolidityOutsideFitRange(
const hydrodynamics::PanelLoadLaw& law,
159 std::vector<double> solidities, ISimObjectLogger& logger)
161 std::sort(solidities.begin(), solidities.end());
162 solidities.erase(std::unique(solidities.begin(), solidities.end()), solidities.end());
163 for (
const double solidity : solidities)
164 hydrodynamics::WarnIfOutsideFitRange(law, solidity, logger);
174inline void WarnIfSolidityExtremesOutsideFitRange(
const hydrodynamics::PanelLoadLaw& law,
175 const std::vector<double>& solidities, ISimObjectLogger& logger)
177 if (solidities.empty()) {
180 const auto extremes = std::minmax_element(solidities.begin(), solidities.end());
181 WarnIfSolidityOutsideFitRange(law, {*extremes.first, *extremes.second}, logger);
Class containing the description of a net panel and methods necessary for taking this over to triangu...
Definition NetElementDef.h:22
double solidity
The net file's optional Sn attribute, for SolidityModel Fixed; 0 when absent. Refinement copies it to...
Definition NetElementDef.h:33
Fluid properties.
Definition PanelLoadTypes.h:34
The panel load law and the fluid shared by all panels of a structure.
Definition NetPanelSetup.h:38
hydrodynamics::Fluid fluid
From Rho and Nu.
Definition NetPanelSetup.h:40
hydrodynamics::PanelLoadLaw law
From HydroModel and the law's parameters.
Definition NetPanelSetup.h:39
The solidity rule of one panel.
Definition NetSolidity.h:104
SolidityModel model
Which rule applies.
Definition NetSolidity.h:105
double fixed
Sₙ for Fixed, dimensionless.
Definition NetSolidity.h:106
double knotFactor
K for MeshOpening.
Definition NetSolidity.h:107