Repository navigation
Binary solutions
extensions/chemistry/solution.mojo models the phases of a binary system, such as the liquid and the solid solutions of an alloy. It gives each component's activity and finds the two-phase regions at a temperature.
This page is a reference. For the rest of the library, see Process chemistry.
A PhaseModel is one phase of components 1 and 2. Its molar Gibbs energy at the mole fraction x of component 2 is:
G = (1 - x) G1 + x G2 + R T ((1 - x) ln(1 - x) + x ln x) + Gex
Gex = x (1 - x) sum_k L_k (1 - 2 x)^k
G1 and G2 are the pure components' energies in this phase. The L_k are the Redlich-Kister parameters. Each is a Linear function of temperature, a + b T. With no L_k, the solution is ideal. With L0 only, it is regular.
| Method | Gives |
|---|---|
excess(x, T) |
Gex, in J/mol |
gibbs(x, T) |
G, in J/mol |
log_gamma(component, x, T) |
The natural log of a component's activity coefficient |
activity(component, x, T) |
The activity, x times the coefficient |
A reaction can take an activity as the fraction of a condensed term. A dissolved metal then has a lower driving force than the pure metal.
phase_boundaries(phases, T) finds the two-phase regions at a temperature. It samples every phase's Gibbs curve and takes their lower convex hull. A stretch of the hull that spans no sampled point is a TieLine. The tie line joins two phases, or two compositions of one phase across a miscibility gap.
The ends of each tie line are the phase boundaries, to the sampling step. The default is 2000 samples, and MAX_SAMPLES is the most. Scan the temperature to draw a phase diagram.
The tests compare the hull with closed forms that it does not use:
- A symmetric regular solution with parameter W has a miscibility gap below
Tc = W / (2 R). Its edges solveln(x / (1 - x)) = W (2x - 1) / (R T). - Two ideal phases form a lens. With
k_i = exp((Gs_i - Gl_i) / R T), the solidus is(1 - k1) / (k2 - k1), and the liquidus is k2 times that. - An activity coefficient equals the partial molar excess energy, from a finite difference of
excess.
The parameters of a real alloy come from an assessment, such as a CALPHAD database. Most such databases are licensed, so the module takes the parameters as inputs. Give each parameter's source beside it, as a stated bound gives its source.
A model has two components. Each phase is one sublattice, with no order. Magnetic and pressure terms are not modeled.
Tutorials
How-to
- Install
- Run the checks
- GPU backend
- Coverage
- Measure examples
- Add a feature
- Add a scanned building
- Write documentation
Reference
- Scene graph
- Rotations
- Cameras
- Geometry
- Geometry addons
- Lofts and clipping groups
- Sculptor
- Procedural generators
- Meshes and assets
- Lines
- Points and sprites
- Helpers
- Scene objects
- Animated objects
- Raycasting
- Curves and paths
- Animation
- Skinning
- Materials
- Node materials
- TSL functions
- Lights
- Lighting addons
- Fog
- Textures
- Renderer
- Renderer hooks and material flags
- Rasterization
- GPU backend
- Render target
- Post-processing
- GPU computation
- Compute nodes
- Progressive light map
- Gaussian splats
- Voxel global illumination
- SVG renderer
- Image files
- Image decode queue
- Model files
- More model files
- Exporters
- Scene JSON
- Windowing and controls
- C ABI and hosts
- Math
- Norm consumers
- Math addons
- Units
- Coverage tool
- Commands
- Examples
- Benchmarks
- Extensions
- Shared physics
- Physics query snapshots
- Continuous collision
- Tick force restoration
- Water
- Warp drives
- Vegetation
- Village
- Streamline
- Animals
-
Buildings
- Numerics
- Building topology
- Building model
- IFC exchange
- Procedural towers
- Floor plans and interiors
- Frame analysis
- Shell analysis
- Building energy
- Construction kits
- Bearing walls
- Scanned buildings
- SOG files
- Compressed PLY files
- Scan parts
- Cleaning and orienting scans
- Walking through a scan
- Virtual scans
- Castle
- CARLA
- Femur
- Tibia
- Fibula
- Patella
- Knee
- Muscles
- Vessels
- Lymph
- Nerves
- Integument
- Leg
- Foot
- Pelvis
- Torso
- Arm
- Hand
- Head
- Genome
- Game humanoid
- Humanoid fidelity
- Mixamo animations
- Audio-aligned game faces
- Converted assets
- Mesh quality
- Garments
- Outfits and armor
- Cloth and spring bones
- Attire estimates
- Segment inertia
- Process chemistry
- Thermochemical data
- Chemical equilibrium
- Process maps
- Rates and transport
- Electrolysis and film color
- Binary solutions
- Flowsheets and routes
- Materials and coatings
- Crystals and figures
Explanation
- Software rasterizer
- Scene graph as an array
- Linear color
- Normals are not colors
- Perspective correction
- Fixed-point coverage
- Per-fragment shading
- Mipmaps
- Sorted transparency
- Types and checks
- Render hooks as a trait
- Shared CPU and GPU code
- Bands and threads
- PNG structure
- Extensions beside the port
- Process temperatures
- Scans as building models
- CUDA teardown hang
- Mojo compiler hang