CelerisLab/legacy/macros.h
2026-04-17 21:50:38 +08:00

108 lines
2.4 KiB
C

// CelerisLab/kernels/macros.h
// cuda parameters
#define MULT_GPU False
#define NT 128
#define X_1U 384
#define Y_1U 192
#define Z_1U 1
// flow parameters
#define LBtype float
#define UX 1
#define UY 1
#define UZ 1
#define NX 384
#define NY 192
#define NZ 1
#define DIM 2
#define NQ 9
#define VIS 0.0144000000
#define RHO 1.0
#define U0 0.04
// constants
#define PI 3.141592653589793238
#define FLUID 0b00000001
#define SOLID 0b00000010
#define GAS 0b00000100
#define INTERFACE 0b00001000
#define SENSOR 0b00010000
// vortex type
#define V_TAYLOR 0b00000001
// variables
#define N_OBJS 0
// #define N_SENS 2
// ============================================================================
// New architecture configuration (Stage 1)
// These defaults are safe for backward compatibility.
// compiler.py can override any of them via modify_macro().
// ============================================================================
// Collision model: 0=SRT, 1=TRT, 2=MRT
#ifndef COLLISION_MODEL
#define COLLISION_MODEL 0
#endif
// Streaming model: 0=double-buffer, 1=esoteric-pull
#ifndef STREAMING_MODEL
#define STREAMING_MODEL 0
#endif
// Storage precision: 0=FP32, 1=FP16S, 2=FP16C
#ifndef STORE_PRECISION
#define STORE_PRECISION 0
#endif
// DDF-shifting: 0=off, 1=on
#ifndef USE_DDF_SHIFTING
#define USE_DDF_SHIFTING 0
#endif
// LES model: 0=off, 1=Smagorinsky
#ifndef USE_LES
#define USE_LES 0
#endif
// Smagorinsky constant C_s
#ifndef LES_CS
#define LES_CS 0.160000f
#endif
// Inlet profile: 1=parabolic (channel), 0=uniform (external flow)
#ifndef INLET_PROFILE
#define INLET_PROFILE 1
#endif
// Outlet mode: 0=non-equilibrium extrapolation, 1=zero-gradient copy (more dissipative)
#ifndef OUTLET_MODE
#define OUTLET_MODE 0
#endif
// Outlet blend factor for damped outlet mode (OUTLET_MODE=2):
// f_out = a*(non-eq extrapolation) + (1-a)*(zero-gradient copy)
#ifndef OUTLET_BLEND_ALPHA
#define OUTLET_BLEND_ALPHA 0.700f
#endif
// Outlet backflow clamp: 0=off, 1=force non-negative streamwise velocity at outlet target
#ifndef OUTLET_BACKFLOW_CLAMP
#define OUTLET_BACKFLOW_CLAMP 1
#endif
// Global collision omega guardrails
#ifndef OMEGA_COLLISION_MIN
#define OMEGA_COLLISION_MIN 0.01f
#endif
#ifndef OMEGA_COLLISION_MAX
#define OMEGA_COLLISION_MAX 1.999f
#endif
// TRT magic parameter Lambda used to map omega+ -> omega-
#ifndef TRT_MAGIC_PARAM
#define TRT_MAGIC_PARAM 0.187500f
#endif