Class FluidODEsExporter

java.lang.Object
jline.solvers.fluid.FluidODEsExporter

public class FluidODEsExporter extends Object
Symbolic export of the mean-field ODE system integrated by SolverFluid. Mirrors the MATLAB implementation in solver_fluid_symodes.m and SolverFLD/exportODEs.m so that all codebases emit the same LaTeX document for a given model. Two representations are produced: form = "W": dx/dt = W'*theta(x) + lambda (methods: default, matrix, pnorm) form = "J": dx/dt = J*r(x) (methods: closing, statedep, softmin)
  • Method Details

    • build

      public static FluidODEsExporter.SymODEs build(NetworkStruct sn, SolverOptions options)
      Build the structural description of the ODE system for the method set in the solver options.
    • render

      public static String render(FluidODEsExporter.SymODEs sys, SolverOptions options, String modelName, String notation)
      Render the LaTeX document for the given system.
      Parameters:
      sys - structural description built by build()
      options - solver options (hide_immediate remark)
      modelName - model name shown in the document
      notation - "scalar" or "matrix"
      Returns:
      LaTeX source
    • stateVariables

      public static List<String> stateVariables(FluidODEsExporter.SymODEs sys)
      State variable names of the exported drift, x1 ... xn.
      Parameters:
      sys - the ODE system
      Returns:
      the variable names
    • conservationConstraints

      public static List<String> conservationConstraints(FluidODEsExporter.SymODEs sys, NetworkStruct sn)
      Linear invariants of the exported drift, as expressions g(x) meaning g(x) = 0.

      The drift conserves the population of every closed chain and the mass held at each (Source, class), but f(x) = 0 cannot see either: on its own it is solved by one point per population, a continuum that the computer algebra engine returns as a free-parameter family or, on p-norm radicals, never finishes. These are the equations that pin the equilibrium down, sent as the constraints of the fluid/odes request. The Source mass is the unit phase mass of the J form and zero in the W form, where the Source state carries no flow. Mirrors conservation_constraints in the native Python symodes.py.

      Parameters:
      sys - the ODE system
      sn - the NetworkStruct the system was built from
      Returns:
      one expression per invariant
    • symbolicDrift

      public static List<String> symbolicDrift(FluidODEsExporter.SymODEs sys)
      Right-hand side of the ODE system as expression strings, one per state variable, in the format the symbolic backend parses.

      ONLY SMOOTH DRIFTS ARE EXPORTED. The default, matrix, closing and statedep methods scale rates by min(n_i, S_i), which is not differentiable at n_i = S_i, so their Jacobian does not exist there; emitting a one-sided derivative would be a silent lie exactly at the regime switch that matters. Use the p-norm smoothing (options.config.pstar) or the softmin method.

      FineTol is carried in exactly the places the integrated systems put it, and nowhere else: the p-norm drift offsets the station total, the softmin drift offsets the phase-weighted total but not the plain station total that feeds the softmin, and the closing rates offset neither. Mirrors @SolverFLD/getSymbolicDrift.m.

      Parameters:
      sys - the ODE system
      Returns:
      one expression per state variable
      Throws:
      RuntimeException - if the drift is not differentiable