feat(thermal): assemble heat operators and preserve typed frame history
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
#ifndef FESA_ANALYSIS_THERMAL_ANALYSIS_STATE_H_
|
||||
#define FESA_ANALYSIS_THERMAL_ANALYSIS_STATE_H_
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "fesa/analysis/thermal_time_grid.h"
|
||||
#include "fesa/assembly/thermal_assembler.h"
|
||||
#include "fesa/results/thermal_result_records.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
/// @brief Owns the immutable thermal result inventory and accepted history.
|
||||
/// @note No Domain/model/assembly references survive Create; state may outlive
|
||||
/// them. Numerical equilibrium and energy checks belong to the procedure before
|
||||
/// Commit.
|
||||
class ThermalAnalysisState final {
|
||||
public:
|
||||
/// @brief Validates the inventory/schedule and commits raw initial
|
||||
/// temperature.
|
||||
/// @note Initial frame has no recovery payload and is never projected onto
|
||||
/// BCs.
|
||||
static Result<ThermalAnalysisState> Create(const AnalysisModel& model,
|
||||
const DofManager& dofs,
|
||||
const ThermalAssembly& assembly);
|
||||
/// @brief Builds a complete typed candidate without changing accepted
|
||||
/// history.
|
||||
/// @param temperature Full node-major temperature, including prescribed
|
||||
/// values.
|
||||
/// @param reaction Constrained full residual in ReactionDofs() order, even if
|
||||
/// empty.
|
||||
/// @param flux Global element fluxes in ElementOrder(), point/trace order.
|
||||
Result<ThermalAcceptedFrame> MakeCompletedFrame(
|
||||
std::uint32_t index, Vector temperature, Vector reaction,
|
||||
std::vector<ThermalElementFlux> flux) const;
|
||||
/// @brief Atomically appends the next finite frame after exact
|
||||
/// mapping/schedule checks.
|
||||
/// @note Rejection preserves every existing frame; caller-owned candidates
|
||||
/// stay independent.
|
||||
Status CommitAcceptedFrame(const ThermalAcceptedFrame& frame);
|
||||
/// @brief Returns accepted frames, beginning with raw frame zero.
|
||||
const std::vector<ThermalAcceptedFrame>& AcceptedFrames() const noexcept;
|
||||
/// @brief Returns the most recently committed state; Create always supplies
|
||||
/// frame zero.
|
||||
const ThermalAcceptedFrame& CommittedState() const noexcept;
|
||||
/// @brief Reports whether every scheduled increment has been committed.
|
||||
bool IsComplete() const noexcept;
|
||||
/// @brief Returns the exact time-grid schedule used to validate accepted
|
||||
/// frames.
|
||||
const ThermalTimeGrid& TimeGrid() const noexcept;
|
||||
/// @brief Returns original nominal dt for metadata, independent of actual
|
||||
/// last delta.
|
||||
double NominalTimeIncrement() const noexcept;
|
||||
/// @brief Returns the exact input end time for metadata.
|
||||
double TimePeriod() const noexcept;
|
||||
/// @brief Returns active Domain node IDs in temperature row order.
|
||||
const std::vector<EntityIndex>& NodeOrder() const noexcept;
|
||||
/// @brief Returns immutable source identities corresponding to NodeOrder().
|
||||
const std::vector<SourceEntityId>& NodeSourceIds() const noexcept;
|
||||
/// @brief Returns Domain element IDs in flux/frame row order.
|
||||
const std::vector<EntityIndex>& ElementOrder() const noexcept;
|
||||
/// @brief Returns immutable source identities corresponding to
|
||||
/// ElementOrder().
|
||||
const std::vector<SourceEntityId>& ElementSourceIds() const noexcept;
|
||||
/// @brief Returns the N by 5 free=0/prescribed=1 mask.
|
||||
const std::vector<std::array<std::uint8_t, 5>>& ConstraintMask()
|
||||
const noexcept;
|
||||
/// @brief Returns prescribed node/source-DOF identities in node/station
|
||||
/// order.
|
||||
const std::vector<ThermalReactionDof>& ReactionDofs() const noexcept;
|
||||
/// @brief Returns E by 4 fixed local frames, stored once for the entire
|
||||
/// history.
|
||||
const std::vector<ThermalElementFrames>& FluxLocalFrames() const noexcept;
|
||||
|
||||
private:
|
||||
/// @brief Takes an exact schedule; Create then fills the validated inventory.
|
||||
ThermalAnalysisState(ThermalTimeGrid grid, double nominal, double period);
|
||||
/// @brief Checks frame metadata, mapping, payload shape and finite values.
|
||||
Status ValidateFrame(const ThermalAcceptedFrame& frame) const;
|
||||
ThermalTimeGrid grid_;
|
||||
double nominal_;
|
||||
double period_;
|
||||
std::vector<EntityIndex> node_order_;
|
||||
std::vector<SourceEntityId> node_source_ids_;
|
||||
std::vector<EntityIndex> element_order_;
|
||||
std::vector<SourceEntityId> element_source_ids_;
|
||||
std::vector<std::array<std::uint8_t, 5>> constraint_mask_;
|
||||
std::vector<ThermalReactionDof> reaction_dofs_;
|
||||
std::vector<ThermalElementFrames> local_frames_;
|
||||
std::vector<ThermalAcceptedFrame> frames_;
|
||||
};
|
||||
|
||||
} // namespace fesa
|
||||
#endif // FESA_ANALYSIS_THERMAL_ANALYSIS_STATE_H_
|
||||
Reference in New Issue
Block a user