#world #cpu #heat #material #brush

thermal_rs

Thermal Conduction Simulation Library

2 releases

Uses new Rust 2024

0.1.2 May 31, 2025
0.1.1 May 30, 2025

#170 in Simulation

50 downloads per month

MIT license

23KB
457 lines

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
    );
}

No runtime deps

Features