高温氦气物性补全;三通四通能量计算bug修正

This commit is contained in:
ljz committed 2026-09-15 17:57:20 +08:00
1 parent 6fc9afe41d
commit 2b07d996cf
133 files changed
+5230 -253310

No files matched your search

+1
View File
@@ -17,4 +17,5 @@ int native_json_format_double(char output[NATIVE_JSON_DOUBLE_CAPACITY], double v
* The caller owns FILE and must check its final flush/close before publishing. */
int native_json_write_number(FILE *file, double value);
int native_json_write_array(FILE *file, const double *values, size_t count, size_t stride);
int native_json_write_values(FILE *file, const double *values, size_t count, size_t stride, int leading_comma);
#endif
+9
View File
@@ -24,14 +24,23 @@ enum {
NATIVE_PROPERTY_PT=1, NATIVE_PROPERTY_H=2, NATIVE_PROPERTY_RHO=4,
NATIVE_PROPERTY_MU=8, NATIVE_PROPERTY_ISENTROPIC=16
};
/* Optional observer for one evaluation, independent of cache capacity.
* Slots: EOS, ideal caloric data, dynamic viscosity; each has min/max T. */
#define NATIVE_PROPERTY_DOMAINS 3
typedef struct {
unsigned seen;
double minimum[NATIVE_PROPERTY_DOMAINS], maximum[NATIVE_PROPERTY_DOMAINS];
} NativePropertyTemperatures;
typedef struct {
NativeMedium medium;
double p, T, h, rho, mu, isentropic_factor, isentropic_exponent;
unsigned valid;
NativePropertyTemperatures *temperatures;
} NativePropertyState;
typedef struct {
NativePropertyState *states;
size_t count, capacity;
NativePropertyTemperatures *temperatures;
} NativePropertyCache;
void native_properties_init(NativePropertyCache *, NativePropertyState *, size_t capacity);
int native_gas_context(NativePropertyCache *, double m, double U, double V, NativeGas *);
+24
View File
@@ -2,6 +2,8 @@
#define NATIVE_RUNTIME_H
#include "model.h"
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#ifndef NFRICTIONS
#define NFRICTIONS 0
#endif
@@ -10,10 +12,19 @@ typedef struct {
int bdf, record_samples;
const char *cancel_path;
} NativeOptions;
typedef struct {
int seen;
double first_time, first_temperature, extreme_time, extreme_temperature;
} NativePropertyWarning;
typedef struct {
NativeOptions options;
double *times, *states;
size_t count, capacity, sample_index;
/* Result history is a bounded buffer, independent of integrator memory. */
size_t buffered, committed, output_count;
FILE *sample_file, *output_file;
const char *sample_path, *output_blocks_path;
int storage_control, storage_failed;
double final_time, final_state[NSTATES];
double wall_start, cpu_start, solve_seconds, solve_cpu_seconds, last_progress;
double max_accepted_step;
@@ -22,13 +33,21 @@ typedef struct {
int jacobian_verify, jacobian_colored;
unsigned long jacobian_rhs, jacobian_colored_evals, jacobian_fallbacks;
unsigned long jacobian_checks, jacobian_mismatches, cvode_rhs, linear_rhs;
unsigned long same_time_returns, same_time_streak, max_same_time_streak;
int stagnating, cvode_flag;
double cvode_return_time, cvode_internal_time, cvode_last_step, cvode_next_step;
const char *failure_reason, *failure_operation;
char message_buffer[384];
int status; /* 0 completed, 1 cancelled, 2 failed */
const char *message;
NativePropertyWarning property_warnings[6];
} NativeRun;
typedef int (*NativeDense)(void *context, double t, double *state);
double native_wall_time(void);
double native_cpu_time(void);
int native_poll(NativeRun *run, double time);
void native_property_warnings_json(NativeRun *run, FILE *file);
int native_fail(NativeRun *run, const char *reason, const char *operation, const char *message);
int native_rhs(NativeRun *run, double t, const double *y, double *dy);
int native_jacobian_rhs(NativeRun *run, double t, const double *y, double *dy);
int native_append(NativeRun *run, double t, const double *y);
@@ -39,4 +58,9 @@ int native_rk45(NativeRun *run);
int native_bdf(NativeRun *run);
int native_solve(NativeRun *run);
void native_run_free(NativeRun *run);
int native_samples_append(NativeRun *run, double t, const double *state);
int native_samples_flush(NativeRun *run);
int native_samples_outputs(NativeRun *run);
int native_samples_json(NativeRun *run, FILE *file, size_t column);
int64_t native_file_tell(FILE *file);
#endif