95 lines
4.2 KiB
C++
95 lines
4.2 KiB
C++
#ifndef FESA_ASSEMBLY_THERMAL_ASSEMBLER_H_
|
|
#define FESA_ASSEMBLY_THERMAL_ASSEMBLER_H_
|
|
|
|
#include <array>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "fesa/analysis/analysis_model.h"
|
|
#include "fesa/assembly/parallel_for.h"
|
|
#include "fesa/elements/element_capabilities.h"
|
|
#include "fesa/elements/thermal_shell.h"
|
|
#include "fesa/fem/dof_manager.h"
|
|
#include "fesa/math/sparse_matrix.h"
|
|
#include "fesa/results/thermal_result_records.h"
|
|
|
|
namespace fesa {
|
|
class ThermalAssembly;
|
|
|
|
/// @brief Builds full K,C,Q from checked DS4 kernels in deterministic source
|
|
/// order.
|
|
/// @note Domain must outlive the returned assembly; neither model nor dofs is
|
|
/// retained. Workers write index-owned buffers only. Failures are selected in
|
|
/// element order.
|
|
Result<ThermalAssembly> AssembleThermal(const AnalysisModel& model,
|
|
const DofManager& dofs,
|
|
const ParallelFor& parallel_for);
|
|
|
|
/// @brief Owns full-space operators and local kernels for a fixed thermal
|
|
/// Domain.
|
|
/// @note The original Domain must remain alive and unmoved for this object's
|
|
/// lifetime.
|
|
class ThermalAssembly final {
|
|
public:
|
|
/// @brief Returns full conductivity [power/temperature] in canonical CSR
|
|
/// order.
|
|
const SparseMatrix& Conductivity() const noexcept;
|
|
/// @brief Returns full consistent capacity [energy/temperature].
|
|
const SparseMatrix& Capacity() const noexcept;
|
|
/// @brief Returns signed full nodal input [power], including prescribed
|
|
/// targets.
|
|
const Vector& HeatInput() const noexcept;
|
|
/// @brief Bounds local interval error plus ordered summation roundoff
|
|
/// entrywise.
|
|
/// @note Excludes quadrature truncation and physical model error.
|
|
const SparseMatrix& ConductivityError() const noexcept;
|
|
/// @copydoc ConductivityError
|
|
const SparseMatrix& CapacityError() const noexcept;
|
|
/// @brief Bounds source-row input summation roundoff entrywise, in power
|
|
/// units.
|
|
const Vector& HeatInputError() const noexcept;
|
|
/// @brief Returns original Domain element IDs in local-kernel/flux row order.
|
|
const std::vector<EntityIndex>& ElementOrder() const noexcept;
|
|
/// @brief Returns checked kernels in stable active element order.
|
|
const std::vector<ThermalShell>& Kernels() const noexcept;
|
|
/// @brief Returns typed views bound after the final kernel buffer is placed.
|
|
const std::vector<std::unique_ptr<ThermalElement>>& Elements() const noexcept;
|
|
/// @brief Returns node-major twenty-entry full DOF scatters in kernel order.
|
|
const std::vector<std::array<std::size_t, 20>>& Scatters() const noexcept;
|
|
/// @brief Checks source Domain identity and the complete supplied equation
|
|
/// map.
|
|
Status ValidateFor(const AnalysisModel& model, const DofManager& dofs) const;
|
|
/// @brief Recovers ordered element-global fluxes from a finite full
|
|
/// temperature.
|
|
Result<std::vector<ThermalElementFlux>> RecoverFlux(
|
|
const Vector& temperature, const ParallelFor& parallel_for) const;
|
|
|
|
private:
|
|
friend Result<ThermalAssembly> AssembleThermal(const AnalysisModel&,
|
|
const DofManager&,
|
|
const ParallelFor&);
|
|
/// @brief Takes completed immutable operators after validation and reduction.
|
|
ThermalAssembly(const Domain& domain, SparseMatrix conductivity,
|
|
SparseMatrix capacity, Vector input,
|
|
SparseMatrix conductivity_error, SparseMatrix capacity_error,
|
|
Vector input_error, std::vector<EntityIndex> element_order,
|
|
std::vector<ThermalShell> kernels,
|
|
std::vector<std::array<std::size_t, 20>> scatters);
|
|
const Domain* domain_;
|
|
SparseMatrix conductivity_;
|
|
SparseMatrix capacity_;
|
|
Vector input_;
|
|
SparseMatrix conductivity_error_;
|
|
SparseMatrix capacity_error_;
|
|
Vector input_error_;
|
|
std::vector<EntityIndex> element_order_;
|
|
// Never resized after construction. Moving the owning vector transfers its
|
|
// buffer, so bound references survive ThermalAssembly moves.
|
|
std::vector<ThermalShell> kernels_;
|
|
std::vector<std::unique_ptr<ThermalElement>> elements_;
|
|
std::vector<std::array<std::size_t, 20>> scatters_;
|
|
};
|
|
|
|
} // namespace fesa
|
|
#endif // FESA_ASSEMBLY_THERMAL_ASSEMBLER_H_
|