thermal_rs

Crates.iothermal_rs
lib.rsthermal_rs
version0.1.2
created_at2025-05-30 19:09:09.893691+00
updated_at2025-05-31 14:24:24.570309+00
descriptionThermal Conduction Simulation Library
homepage
repositoryhttps://github.com/L-P-Lewis/thermal_rs
max_upload_size
id1695590
size23,139
Luke Lewis (L-P-Lewis)

documentation

https://docs.rs/thermal_rs/latest/thermal_rs/

README

thermal_rs provides utlities for preforming discreet simulations of heat conduction in voxelized worlds.

Features

  • Creation of simulation worlds from brush based geometry
  • Addition of 3d models to simulation worlds
  • Provides multiple implementations of heat flow simulation
    • Single Threaded CPU simulation
    • Multithreaded CPU simulation
    • GPU simulation

Usage

use thermal_rs::{world::{SimWorld, SimWorldBuilder, SimState}, material, material::Material, volume::AABBVolume, runner::{SimRunner, cpu::CPUSimRunner}};

fn main() {
    // Create a simulation world with a base of water and a resolution of 2 voxels/meter
    let sim_world = SimWorldBuilder::new(5.0, 2.0, 5.0)
        .with_material(
            material::WATER,
            Box::new(AABBVolume::new(0.0, 0.0, 0.0, 10.0, 5.0, 10.0))
        ).build(0.5);

    let mut initial_state = sim_world.get_blank_sim_state();
    initial_state = sim_world.set_sim_state_temperature(
        initial_state,
        300.0,
        &AABBVolume::new(0.0, 0.0, 0.0, 5.0, 5.0, 5.0)
    ).unwrap();

    // Create a simple cpu simulation runner
    let cpu_runner = CPUSimRunner {};

    // Calculate the simulation at an advanced state of 1 second into the future given a timestep of 0.01 seconds
    let sim_result = cpu_runner.advance_simulation(
            &sim_world,
            &initial_state,
            1.0,
            0.01
    );
}
Commit count: 30

cargo fmt