|
FhSim
3.1.0
Marine systems simulation
|
How the library is tested, and which test file covers what. The file table in section 2 is a count of the TEST, TEST_F and TEST_P macros per file of tests/*_Test.cpp, taken at version 3.1.4. It is not generated by a script: recount when test files are added or removed.
The gtest binary test_fhsim_marine_elements (tests/CMakeLists.txt) builds the 80 *_Test.cpp files of tests/ plus RunTests.cpp. Shared helpers: tests/TestUtils.h (RunAndCompareRegressionXmlTiming, timing parsing), tests/JacobianTestUtils.h (ExpectJacobiansMatch, a wrapper around fhsim::test::CheckJacobians that fails if nothing was checked) and the *_TestSupport.h headers. tests/CMakeLists.txt also builds the test-only SimObject library fhsim_marine_elements_test_objects (tests/objects/: Test/ForceSource, Test/SignalSink, Test/FlowProbe, Test/NodeTow). It is not installed.
The ctest entries (tests/CMakeLists.txt):
| Entry | Runs | Label |
|---|---|---|
fhsim_marine_elements | every suite of test_fhsim_marine_elements (no *_SLOW suite today, so no _slow entry) | unit |
fhsim_marine_elements_datasets | every suite of test_fhsim_marine_elements_datasets (NetValidation_*, OldVsNew, NetPanel) except *_VALIDATION and *_DATAGEN | regression |
fhsim_marine_elements_datasets_validation | the *_VALIDATION suites of the datasets executable (the Zhan S6 Runge-Kutta case) | validation, slow |
fhsim_marine_elements_datasets_datagen | the *_DATAGEN suites (WritesReport, which write tests/out/*.txt) | regression, datagen |
fhsim_marine_elements_perf | SimObjectPerf.*, run with the disabled test | perf |
fhsim_marine_elements_TrawlCable_NoClumpWeight | one regression test alone in its process | smoke |
fhsim_marine_elements_install_headers | installs the library component into the build tree and compares the header list with tests/install/installed_headers.txt | unit |
Run the default entry with ctest -R fhsim_marine_elements from the build directory, or call the built test_fhsim_marine_elements[_d] or test_fhsim_marine_elements_datasets[_d] binary with a working directory and a gtest filter (see tests/RunTests.cpp). The conan conf user.fhsim:test_tier decides which entries a conan build runs (see DEVELOPING.md).
Inputs live under tests/in/<SimObjectName>/ (for example tests/in/Disk/Disk_in.xml, Disk_ref.csv, Disk.ref). Auxiliary nets named by File= attributes are copied to the binary's working directory by tests/CMakeLists.txt.
There are 33 regression baselines: tests/in/*/<ID>.ref with <ID>_ref.csv, compared by RunAndCompareRegressionXmlTiming. The baselines, their plots and the owner approvals are in Regression baselines (doc/user/baselines/). The net SimObjects are validated against measurements in Net hydrodynamics: SimObject-level validation report (generated by tests/plot_validation.py).
The only disabled test is SimObjectPerf.DISABLED_NetStructureWithConstraints_RegressionThreads, a wall-clock guard (MARE-0380) that the fhsim_marine_elements_perf entry runs on its own; the fast tier runs the same case against its reference in SimObject.NetStructureWithConstraints_RegressionThreadsMatchesItsReference. See also Disabled tests. No Ogre or visualization-gated tests exist in this suite.
fhsim::test::TestSpec.jacobianMode defaults to Auto (fhsim/include/fhsim/testtools/TestSpec.h). A RunTest() call left at that default runs CheckJacobians on the whole scenario after the run, and fails the test on a mismatch, whenever any SimObject in the scenario reports HasJacobians()==true. A test that should not do this sets jacobianMode=No. Tests that call ExpectJacobiansMatch call CheckJacobians directly and bypass jacobianMode. The checker also samples states along the scenario's own integrator (trajectorySamples) and repeats each check with a neutral stateful object placed first (shiftStateOffsets), so every object sits at a non-zero state offset.
| File | Tests | Suites |
|---|---|---|
BodyWake_Test.cpp | 12 | BodyWake, Disk, BodyWaves |
CableAxialLaw_Pin_Test.cpp | 4 | CableAxialLawPin |
CableBranched_FileLookup_Test.cpp | 1 | SimObject |
CableBranched_FluidRho_Test.cpp | 1 | SimObject |
CableBranched_Jacobian_Test.cpp | 6 | SimObject |
CableBranched_PortStorage_Test.cpp | 2 | CableBranched |
CableBranched_Test.cpp | 4 | SimObject, CableBranched |
CableConnector_Test.cpp | 2 | SimObject |
CableElBasicsDrag_Test.cpp | 7 | CableElBasicsDrag, SimObject, CableElBasicsDragJacobian |
CableElDynStiff_FailedCheck_Test.cpp | 1 | SimObject |
CableElDynStiff_MeanTension_Test.cpp | 2 | CableElDynStiff |
CableJointMoment_Test.cpp | 6 | CableJointMoment |
CableLengthBound_Test.cpp | 2 | CableJacobian, CableBranchedJacobian |
CableMaxTension_Test.cpp | 2 | CableJacobian, CableBranchedJacobian |
CableModelsHydrodynamics_Test.cpp | 6 | CableModelsHydrodynamics |
CableNumericalDamping_Test.cpp | 4 | CableNumericalDamping |
CableRMStart_Pin_Test.cpp | 3 | CableRMStartPins |
CableSegment_Test.cpp | 11 | CableSegment |
CableWakes_Test.cpp | 17 | CableWakes |
CableWaves_Test.cpp | 17 | CableWaves, ElementWaterLoad |
Cable_DefaultsMatchDocumentation_Test.cpp | 2 | SimObject |
Cable_EvaluationOrder_Test.cpp | 5 | CableBranched, Cable |
Cable_Test.cpp | 6 | SimObject |
Cable_Threads_Test.cpp | 1 | Cable |
Contracts_Test.cpp | 1 | Contracts |
Disk_Test.cpp | 8 | SimObject |
ElementStates_Pin_Test.cpp | 3 | SimObject |
GaussPointDrag_Test.cpp | 10 | GaussPointDrag, SimObject |
MaxAccelerationRemoved_Test.cpp | 4 | SimObject |
NetCore_Pin_Test.cpp | 7 | NetCorePin, NetCoreCables |
NetElement3NForces_Test.cpp | 7 | NetElement3NForces |
NetFlowInteraction_Test.cpp | 5 | NetFlowInteraction |
NetPanelSetup_Test.cpp | 1 | NetPanelSetup |
NetSpec_Test.cpp | 45 | TrawlNetSpec, TrawlNetSpecReader, SNetSection, NetStructureSpec, NetStructure, LoadNet, SimObject, NetElementDef |
NetStructureTestFamily_Test.cpp | 6 | NetStructureTestFamily |
NetStructureWithConstraints_Regression_Test.cpp | 4 | SimObject, SimObjectPerf |
NetStructureWithConstraints_Test.cpp | 17 | SimObject |
NetStructureWithConstraints_Threads_Test.cpp | 1 | SimObject |
NetStructureWithConstraints_Wake_Test.cpp | 5 | SimObject |
NetStructure_BottomContact_Test.cpp | 12 | NetStructureBottomContact |
NetStructure_CableClamp_Test.cpp | 3 | NetStructureJacobian |
NetStructure_CableRho_Test.cpp | 6 | SimObject |
NetStructure_DiskDrag_Test.cpp | 4 | SimObject |
NetStructure_FileLookup_Test.cpp | 4 | SimObject, NetInput |
NetStructure_FreeDrift_Test.cpp | 1 | SimObject |
NetStructure_JacobianOptOut_Test.cpp | 8 | SimObject, NetStructureBdfTouchdown |
NetStructure_Jacobian_Test.cpp | 6 | SimObject, NetStructurePanelJacobianPerLaw |
NetStructure_MeanTension_Test.cpp | 1 | NetStructure |
NetStructure_NanForce_Test.cpp | 1 | SimObject |
NetStructure_PanelWeight_Test.cpp | 1 | SimObject |
NetStructure_PortJacobian_Test.cpp | 5 | SimObject |
NetStructure_PortThreads_Test.cpp | 2 | NetStructure |
NetStructure_Regression_Test.cpp | 1 | SimObject |
NetStructure_Solidity_Test.cpp | 12 | SimObject |
NetStructure_Sparsity_Test.cpp | 3 | NetStructureSparsity |
NetStructure_Threads_Test.cpp | 3 | SimObject, NetThreads |
NetStructure_Wake_Test.cpp | 11 | SimObject |
NetStructure_Waves_Test.cpp | 8 | NetStructureWaves |
NetValidation_LaderCage_Test.cpp | 5 | NetValidation_LaderCage, NetValidation_LaderCage_FinalStates, NetValidation_LaderCage_DATAGEN |
NetValidation_TowedPanel_Test.cpp | 6 | NetValidation_TowedPanel, NetValidation_TowedPanel_DATAGEN |
NetValidation_Trawl_Test.cpp | 2 | NetValidation_Trawl |
NetValidation_ZhanCylinder_Test.cpp | 9 | NetValidation_ZhanCylinder, NetValidation_ZhanCylinder_VALIDATION, NetValidation_ZhanCylinder_DATAGEN |
NetWake_Test.cpp | 37 | NetWake |
OdeJacobian_PortState_Test.cpp | 4 | Cable, CableBranched, Disk, TrawlBeam |
OldVsNew_Validation_Test.cpp | 15 | OldVsNew, OldVsNew_CableRbAngleSweep, OldVsNew_CableRbReynoldsSweep, OldVsNew_ClumpMeTopTension, OldVsNew_NetSheetShape, NetPanel |
OneThreadTwins_Test.cpp | 2 | OneThreadTwin |
RbCable_Test.cpp | 39 | SimObject, CableRM |
RigidBarCable_Test.cpp | 7 | SimObject, RBCEngine |
SCableSectionData_Test.cpp | 4 | SCableSectionData |
SeabedContact_Pin_Test.cpp | 9 | SeabedContactPin |
Sphere_Test.cpp | 6 | SimObject |
TestUtils_Test.cpp | 16 | TestUtils |
TrawlBeam_Test.cpp | 4 | SimObject |
TrawlCableCollisionManager_Test.cpp | 3 | TrawlCableCollisionManager |
TrawlCableWakes_Test.cpp | 13 | TrawlCableWakes |
TrawlCableWater_Test.cpp | 4 | TrawlCableWater |
TrawlMooring_Test.cpp | 28 | SimObject |
WaveHull_Test.cpp | 25 | WaveHull |
WavePropulsionHull_Test.cpp | 14 | WavePropulsionHull |
WetCylinderLaw_Pin_Test.cpp | 5 | WetCylinderLawPin |
Total: 597 tests in 80 files (a TEST_P counts once). The suite name is the first argument of the macro; a suite ending in _VALIDATION runs in the validation entry of the datasets executable, one ending in _DATAGEN in its datagen entry.
HasJacobians() or OdeJacobian is implemented in: Disk, Sphere, Cable (Cable/LumpedMass), CableBranched, CableConnector, NetStructure, TrawlBeam and WaveHull. The others use FhSim's finite-difference fallback. Notes:
InternalCable::ComputeStructuralJacobian (src/cable/subroutines/): position-velocity identity, a numerical-damping diagonal term, and the structural spring and damper blocks of each segment while the tension is inside its bounds.InternalCable blocks plus the junction coupling.InternalCable kernel; panel blocks by forward-mode automatic differentiation (sfh::ad::Dual<12>) of the templated force core NetElement3NForces (src/net/JACOBIAN_RECIPE.md). HasJacobians() is false, and FhSim uses finite differences, while a mass or velocity adaptation is active, while a cable element carries a sphere or disk, and while a node is in bottom contact (MARE-0134). InputPortJacobian() and OutputPortJacobian() are tested in NetStructure_PortJacobian_Test.cpp with Test/ForceSource and Test/SignalSink. StrainEnergy has no port Jacobian.