Hamza CharifRIDGECV

ProjetsRIDGE

RIDGE

From primary-drying simulation to certified, PLC-compatible recipe design

Written August 2026 · Last updated 2 August 2026

At a glance
ContextIndependent personal project
PeriodDecember 2025 to present
RoleSole author: modelling, numerical implementation, verification and optimisation
DomainFreeze-drying · primary drying
MethodsQuasi-steady-state modelling · Moving-boundary Stefan problem · Method of manufactured solutions · Optimal-control analysis · Dynamic programming
StackPython · NumPy · Vectorised numerical methods · GPU-accelerated enumeration
StatusResearch and implementation ongoing
Contents
  1. 1. The problem
  2. 2. Why I built more than one model
  3. 3. Stage 1: quasi-steady-state simulator
  4. 4. Stage 2: full Stefan formulation
  5. 5. Verifying the moving-boundary solver
  6. 6. From numerical observation to an optimal-control result
  7. 7. RIDGE: from an ideal policy to an executable recipe
  8. 8. What the optimisation actually buys
  9. 9. What is established, and what is not
  10. 10. Current limitations and next work

The problem

Primary drying is the moving-boundary phase of freeze-drying: heat supplied through the vial drives sublimation at an ice interface that recedes through the product. The operating recipe controls shelf temperature and chamber pressure, while product-temperature and equipment-capacity constraints limit how aggressively the cycle can be run.

Three stages of primary drying in a vial: the sublimation front starts near the top and recedes downward, leaving a growing dried cake above it and a shrinking frozen layer below, with heat entering through the shelf and vapour leaving through the cake.

The geometry the whole project rests on. The front position is the state variable; the recipe acts on it only indirectly, through shelf temperature and chamber pressure. Schematic: the panels show the front qualitatively and encode no time or temperature.

This creates two related engineering questions:

  1. What continuous control policy minimises primary-drying time under the model and its constraints?
  2. How can that ideal policy be converted into the finite setpoint steps that an industrial controller can execute, without giving away an economically meaningful amount of performance?

RIDGE is my attempt to answer the second question on top of a simulator and control result built specifically for the first.

Why I built more than one model

A quasi-steady-state model is fast enough to explore large numbers of recipes, but it suppresses part of the transient heat dynamics. A full Stefan model retains the moving-boundary heat equation, but it is more expensive and more difficult to verify.

Rather than treating one as universally correct, I built both. The QSS model supports rapid analysis and optimisation; the full model provides a more detailed reference for understanding when the approximation is adequate and where transient behaviour matters.

This separation also makes the numerical work easier to audit. Disagreement between the models can be investigated as modelling error, while disagreement between numerical schemes inside one model points to an implementation or discretisation issue.

Stage 1: quasi-steady-state simulator

I derived the QSS implementation from the primary heat- and mass-transfer equations instead of starting from a pre-existing simulator. At each state, the coupled nonlinear relations determine the sublimation conditions; I solved the resulting system with a Newton iteration and then advanced the drying state in time.

I implemented and compared several integration options, from explicit Euler to fourth-order Runge–Kutta. This was useful for two reasons: it exposed the accuracy/runtime trade-off directly, and it gave independent convergence behaviour against which to check the trajectory.

The result was not only a forward simulator. It became an experimental tool for asking how optimal controls behave across different states, constraints and recipe choices.

Stage 2: full Stefan formulation

The higher-fidelity model treats primary drying as a Stefan problem: a heat equation on a domain whose boundary moves with the sublimation front. The motion of that front couples the temperature field to the mass removed.

Moving domains are awkward to discretise directly. I used a Landau transformation to map the changing physical region onto a fixed computational domain. I then discretised the transformed spatial equations and integrated the resulting system of ordinary differential equations with the method of lines.

The implementation is vectorised in NumPy. That matters here because the model must be run repeatedly across controls and parameter sets; avoidable Python loops would turn verification and optimisation into the dominant cost.

Verifying the moving-boundary solver

For the full Stefan implementation, agreement with a plausible-looking drying curve is not enough. A numerical solver can produce smooth, physical-looking results while carrying an error in a transformed term or boundary condition.

I therefore used the method of manufactured solutions. The procedure is to choose a known analytical field and moving-front trajectory, substitute them into the transformed equations, and derive the forcing terms required to make that chosen solution exact. The numerical method is then tested on a problem whose answer is known by construction.

This verifies whether the discretised equations, transformed boundary conditions and time integration recover the manufactured solution as the grid is refined. It is a verification of the code and numerical formulation, not an experimental validation on a real product.

From numerical observation to an optimal-control result

While running the simulators, I repeatedly observed the same structure in the best controls. This led me to conjecture that the optimal action was the lexicographically maximal admissible control: at each Markov state, choose the largest feasible control according to a fixed priority ordering, subject to the process constraints.

I tested that conjecture computationally with a GPU-accelerated brute-force search. Across the cases examined, exhaustive comparison recovered the same policy as the conjectured rule.

The brute-force result was evidence, not a proof. After further analysis, I proved the lexmax policy to be optimal for the Markovian primary-drying formulation. The qualification is important: the theorem is a result about the stated model, state definition, admissible controls and objective. It does not by itself establish that an unmodelled dryer or product follows the same policy.

RIDGE: from an ideal policy to an executable recipe

An optimal continuous policy is not yet a production recipe. A PLC executes a limited number of steps, uses finite setpoint resolutions and must respect equipment-related restrictions on when and how controls change.

RIDGE takes recipes generated from the continuous policy and searches for an implementable approximation around the lexmax structure. Its dynamic programme tracks the drying state while enforcing constraints such as:

  • a fixed budget on the number of recipe steps;
  • discrete controller setpoints;
  • admissible transitions between successive steps;
  • process feasibility along the complete trajectory.

Because the search is organised around the proved control structure, it does not need to treat every arbitrary recipe as equally plausible. The algorithm can stop when it finds a feasible discrete recipe whose certified gap from the continuous ideal falls below a chosen threshold of economic significance.

This stopping rule is part of the engineering objective. Pursuing another tiny fraction of theoretical improvement is not useful if the difference is worth less than the complexity it adds to implementation or qualification.

What the optimisation actually buys

On the two formulations that serve as references in this literature, the optimised policy gives roughly 62 % faster primary drying for 5 % mannitol and 50 % faster for 5 % sucrose, measured against typical cycle conditions.

Those two numbers are not my contribution, and it would be misleading to present them as one. They are consistent with what the continuous-recipe literature already reports. Recovering them was a check: it is what a correct model and a correct control result are supposed to produce, and failing to reproduce them would have been evidence of a mistake.

Bar chart of primary drying time as a percentage of a typical cycle, for two formulations. Five per cent mannitol falls from 100 per cent to 38 per cent, a 62 per cent reduction. Five per cent sucrose falls from 100 per cent to 50 per cent, a 50 per cent reduction.

Primary drying time under the optimised policy, relative to typical cycle conditions. The reductions reproduce figures already reported for continuous recipes; what changes here is the equipment they require.

The contribution is the sentence that carries them. Papers reporting gains of this size generally close with a call to modernise equipment or to move to continuous control, which places the saving out of reach of the installed base. The result here is that the same gains are reachable with a discrete, step-limited recipe, executable on a classical industrial lyophilizer, within a certified gap from the continuous ideal that is chosen to be economically insignificant.

So the claim is not that primary drying can be made much faster. That was already known. The claim is that the fast recipe does not require a new machine.

What is established, and what is not

The project currently supports four distinct claims:

  • the QSS equations have been implemented and tested across multiple time integration schemes;
  • the transformed Stefan solver has been numerically verified using manufactured solutions;
  • the GPU brute-force search recovers the conjectured control structure in the tested cases;
  • the lexmax policy has been proved optimal for the defined Markovian model, and RIDGE uses that structure in a constrained dynamic programme.

The project does not yet claim experimental validation against a real freeze-dryer or a specific product. Physical validation would require measured cycle data and identified product/equipment parameters. Until then, the certificate concerns optimisation and discretisation within the model, not the accuracy of the model relative to a production batch.

Current limitations and next work

  • Model fidelity. The QSS and full Stefan descriptions make different approximations. The useful question is not which label is more advanced, but when those approximations alter the preferred recipe.
  • Parameter uncertainty. A recipe can be optimal for nominal heat- and mass-transfer parameters and fragile when those values move.
  • Controller detail. Step budgets and setpoint discretisation are included, but industrial PLC and equipment constraints must ultimately be defined for a specific dryer.
  • Experimental validation. Manufactured solutions verify the mathematics implemented in code; they do not validate product behaviour.

The next stage is to consolidate the theorem, numerical evidence and RIDGE algorithm into one reproducible workflow, then test how the certified discrete gap behaves when model parameters and controller constraints vary.

Questions about this work? [email protected]