A Data-Oriented Toolkit for Multi-Domain Surrogate Modeling & Simulation
clj-physics is a high-assurance, idiomatic Clojure library designed for modeling, simulation, and synthetic data generation.
Unlike traditional finite-element solvers that prioritize microscopic fidelity at the cost of computational expense, clj-physics focuses on surrogate modeling, fast-time simulation, and uncertainty quantification. It provides a unified data-driven interface for rigid-body dynamics (6-DOF), computational fluid dynamics (CFD) approximations, and electromagnetic (EM) propagation.
The library is built on three core principles:
BigDecimal precision when necessary.Avoids the computational cost of full Navier-Stokes solvers by using reduced-order models suitable for mission planning and real-time synthesis.
A robust engine for modeling RF propagation, safety envelopes, and material interaction.
A complete 6-Degrees-of-Freedom (6-DOF) simulation stack.
Pull from Clojars:
;; deps.edn
net.clojars.helsingin/physics {:mvn/version "0.1.1"}
(require '[physics.electromagnetics.fields :as f]
'[physics.electromagnetics.materials :as m]
'[physics.electromagnetics.propagation :as p]
'[physics.frames :as frames]
'[physics.environment :as env]
'[physics.dynamics :as dyn])
;; 1. Build a field and propagate it
(def field (f/->field {:type :electric :frequency-hz 2.4e9 :amplitude 1.0 :orientation [0 0 1]}))
(def air (m/->material {:name "air" :type :dielectric :permittivity-relative 1.0006 :conductivity 0.0}))
(p/propagate-plane-wave field air 100.0)
;; 2. Frame transforms (WGS84 <-> ECEF)
(def origin {:position [37.62 -122.38 0.0]})
(frames/geodetic->ecef {:lat 37.62 :lon -122.38 :alt 0.0})
;; 3. Dynamics: compute derivatives for a fixed-wing state
(def model (physics.models.common/fixed-wing))
(def state {:position [0 0 1000]
:velocity [60 0 0]
:orientation (physics.core/euler->quaternion {:roll 0 :pitch 0 :yaw 0})
:angular-rate [0 0 0]})
(dyn/rigid-body-derivatives model state (env/isa-profile 1000) {:throttle 0.5})
clojure -M:test
Tests cover core math, frames, environment, dynamics, constraints, integrators, observer, CFD, electromagnetics, and spatial utilities. A default tests.edn is included for Kaocha with a pinned seed.
clojure -T:build jarmake deploy (reads credentials from ~/.m2/settings.xml server clojars, or falls back to CLOJARS_USERNAME/CLOJARS_PASSWORD if exported)Licensed under GPL-3.0-only. See LICENSE for details.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |