Integrate Refactor solver sources and dual MSVC CMake builds
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "fesa/assembly/thermal_assembler.h"
|
||||
#include "thermal_transient_bounds.h"
|
||||
#include "math/dense_blas_internal.h"
|
||||
#include "math/finite_values.h"
|
||||
|
||||
namespace fesa::thermal_transient_internal {
|
||||
namespace {
|
||||
@@ -35,9 +37,7 @@ Status Failure(const std::string& message) {
|
||||
}
|
||||
/// @brief Checks every scalar while preserving signed temperatures and powers.
|
||||
bool Finite(const Vector& vector) {
|
||||
for (std::size_t i = 0; i < vector.Size(); ++i)
|
||||
if (!std::isfinite(vector[i])) return false;
|
||||
return true;
|
||||
return math_internal::IsFinite(vector);
|
||||
}
|
||||
/// @brief Checks aligned full operators and their coefficient-error storage.
|
||||
bool SamePattern(const SparseMatrix& a, const SparseMatrix& b) {
|
||||
@@ -500,6 +500,16 @@ Status RunThermalHistory(const ThermalAssembly& assembly,
|
||||
const DofManager& dofs, ThermalAnalysisState& state,
|
||||
LinearSolver& solver, const ThermalRecovery& recovery,
|
||||
std::vector<ThermalStepEvidence>* evidence) {
|
||||
const BackwardEulerHeatIntegrator integrator;
|
||||
return RunThermalHistory(assembly, dofs, state, solver, integrator, recovery,
|
||||
evidence);
|
||||
}
|
||||
|
||||
Status RunThermalHistory(const ThermalAssembly& assembly,
|
||||
const DofManager& dofs, ThermalAnalysisState& state,
|
||||
LinearSolver& solver, const HeatStepIntegrator& integrator,
|
||||
const ThermalRecovery& recovery,
|
||||
std::vector<ThermalStepEvidence>* evidence) {
|
||||
if (!dofs.ValidateInvariants().IsOk() ||
|
||||
dofs.Profile() != DofProfile::kThermal ||
|
||||
dofs.FullDofCount() != state.CommittedState().temperature.Size() ||
|
||||
@@ -517,19 +527,21 @@ Status RunThermalHistory(const ThermalAssembly& assembly,
|
||||
i <= count; ++i) {
|
||||
const auto frame = state.TimeGrid().Frame(static_cast<std::uint32_t>(i));
|
||||
if (!frame.HasValue()) return frame.GetStatus();
|
||||
auto candidate = SolveThermalIncrement(system, partition,
|
||||
state.CommittedState().temperature,
|
||||
frame.Value().delta, solver, cache);
|
||||
if (!candidate.HasValue()) return candidate.GetStatus();
|
||||
auto flux = recovery(candidate.Value().temperature);
|
||||
if (!flux.HasValue()) return flux.GetStatus();
|
||||
auto completed = state.MakeCompletedFrame(
|
||||
static_cast<std::uint32_t>(i), std::move(candidate.Value().temperature),
|
||||
std::move(candidate.Value().reaction), std::move(flux.Value()));
|
||||
if (!completed.HasValue()) return completed.GetStatus();
|
||||
const auto committed = state.CommitAcceptedFrame(completed.Value());
|
||||
if (!committed.IsOk()) return committed;
|
||||
if (evidence) evidence->push_back(candidate.Value().evidence);
|
||||
const Status step_status = RunThermalStep(
|
||||
integrator, system, partition, state.CommittedState().temperature,
|
||||
frame.Value().delta, solver, cache, recovery,
|
||||
[&](ThermalStepCandidate&& candidate,
|
||||
std::vector<ThermalElementFlux>&& flux) -> Status {
|
||||
auto completed = state.MakeCompletedFrame(
|
||||
static_cast<std::uint32_t>(i), std::move(candidate.temperature),
|
||||
std::move(candidate.reaction), std::move(flux));
|
||||
if (!completed.HasValue()) return completed.GetStatus();
|
||||
const auto committed = state.CommitAcceptedFrame(completed.Value());
|
||||
if (!committed.IsOk()) return committed;
|
||||
if (evidence) evidence->push_back(candidate.evidence);
|
||||
return Status::Ok();
|
||||
});
|
||||
if (!step_status.IsOk()) return step_status;
|
||||
}
|
||||
return Status::Ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user