constraints.solve.solve_constraints

constraints.solve.solve_constraints(sdf, *, tol=1e-06, max_steps=256)

Solve geometric constraints attached to a scene’s free parameters.

Extracts free parameters from the SDF tree, discovers all constraints registered on them, checks that the system is exactly constrained, then runs Levenberg-Marquardt (via optimistix) to find parameter values that satisfy all constraints.

Parameters

Name Type Description Default
sdf Fluent The SDF tree whose free parameters should be solved. required
tol float Convergence tolerance (used as both rtol and atol). 1e-06
max_steps int Maximum solver iterations. 256

Returns

Name Type Description
dict[str, Any] A free_params dict (same format as extract_parameters) with solved
dict[str, Any] parameter values — ready to pass to functionalize.

Raises

Name Type Description
ValueError If the scene is under- or over-constrained.
RuntimeError If the solver does not converge.

Example

solved_params = solve_constraints(scene)
sdf_fn = functionalize(scene)(solved_params, fixed_params)