Skip to content

Antisolvent Crystallization with Solvent Recovery

In this tutorial you will crystallize ibuprofen from ethanol by adding water, which dissolves almost none of it. The crystals are filtered and dried, a distillation column recovers the ethanol from the mother liquor, and two recycles send the ethanol and most of the water back to the process. The result is the yield of the plant, the solvent it consumes and the duty of the column, and a table that shows how the amount of water trades yield against reboiler duty.

What you will learn

  • How an antisolvent lowers the solubility of a solute, and how a ternary NRTL fitted to measured solubilities describes it
  • How to set up a Crystallizer in antisolvent mode that takes the solubility from the property package
  • Why the recovery column needs a property package of its own
  • How to close a solvent loop and an antisolvent loop with two recycles, and why the solvent make-up has to equal the losses

Prerequisites

Process Overview

Ibuprofen is very soluble in ethanol, about 1.1 g per g of ethanol at 25 °C, and nearly insoluble in water. If you add water to an ethanol solution, the ibuprofen comes out as crystals without any cooling. The plant dissolves 500 kg/h of crude ibuprofen in recovered ethanol, adds water at 25 °C, filters and dries the crystals, and distils the mother liquor. The ethanol leaves the top of the column and goes back to the dissolver. The water and the ibuprofen that stayed dissolved leave the bottom, and most of the bottoms go back to the crystallizer as antisolvent.

The design question is how much water to add. More water crystallizes more ibuprofen in each pass, but all of it has to go through the column, where it is boiled up while the ethanol is stripped.

graph LR
    B["Crude ibuprofen<br/>500 kg/h"] --> D["MIX-101 + H-101<br/>dissolver, 30 °C"]
    D --> C["CRY-101<br/>antisolvent, 25 °C"]
    W["Make-up water"] --> A["MIX-102"] --> C
    C --> F["FT-101<br/>filter"]
    F -- wet cake --> Y["DRY-101 + V-101<br/>dryer, 50 °C, 0.1 bar"] --> P["Ibuprofen product"]
    Y -- vapor --> K["C-101 + P-102"]
    F -- mother liquor --> M["P-101 + MIX-104"]
    K --> M --> H["H-102<br/>80 °C"] --> T["T-101<br/>20 stages"]
    T -- distillate --> R1["C-102 + REC-101"] --> D
    T -- bottoms --> S["C-103 + SPL-101"]
    S -- 80 % --> R2["REC-102"] --> A
    S -- 20 % --> X["Waste water"]

Key Design Parameters

Parameter Value
Compounds Ibuprofen, Ethanol, Water
Property packages NRTL with solids for the crystallization section; a second NRTL for H-102 and T-101
Crude ibuprofen 500 kg/h, 25 °C, 1.01325 bar
Make-up ethanol / water 0.02 / 121 kg/h
Dissolver H-101 30 °C
Crystallizer CRY-101 antisolvent mode, 25 °C, solubility from the property package
Filter FT-101 design mode, 0.5 bar of pressure drop, 15 % cake moisture
Dryer DRY-101 / V-101 50 °C, 0.1 bar
Column feed heater H-102 80 °C, 1.3 bar
Column T-101 20 stages, feed on stage 12, 1.01325 bar, distillate 3.87 mol/s, boil-up ratio 1.5, Naphtali-Sandholm solver
Splitter SPL-101 80 % of the bottoms back as antisolvent, 20 % to waste water

Step-by-Step in the Classic UI

1. Set up the compounds and the crystallization package

File > New Chemical Process Model: add Ibuprofen, Ethanol and Water, and add an NRTL property package. Name it NRTL + solids (crystallization). The values below are in °C, bar, kg/h and kW.

Press Configure on the package and enter the three pairs in the grid of interaction parameters. The pairs with ibuprofen depend on temperature: τ = (A + B·T) / (R·T), with A in cal/mol, B in cal/(mol·K) and T in K. Ibuprofen is the first compound of both pairs.

Pair (1 / 2) A12 A21 B12 B21 alpha12
Ibuprofen / Ethanol -3549.744 6877.817 9.67178 -19.13966 0.3
Ibuprofen / Water -1960.298 -10088.042 30.45368 66.70384 0.2
Ethanol / Water -57.9601 1241.7396 0 0 0.2937

The ethanol / water pair is the one of the DWSIM database. Uncheck Try Automatic Estimation of Missing NRTL/UNIQUAC/Wilson Parameters, so that the package doesn't replace any pair with an estimate. In the flash settings of the package, check Handle Solids: ibuprofen then leaves the flash as a solid wherever the liquid can't hold it.

Where the parameters come from

The two ibuprofen pairs were fitted together, for the Case Library case this tutorial is based on, to the solubility of ibuprofen in absolute and aqueous ethanol at 10, 25 and 40 °C measured by Rashid et al. (2011), with the fusion data of the compound: melting point 75.1 °C and enthalpy of fusion 26.42 kJ/mol. The energies vary linearly with temperature because a fit with constant energies missed the data by a factor of about two. The fit is a correlation for 10 to 40 °C, so the crystallization section stays inside that range.

The script of this tutorial checks the model against the paper:

T (°C) Water in the solvent (wt %) Measured (g/g ethanol) Model Deviation (%)
10 0 0.600 0.609 +1.5
25 0 1.138 1.124 -1.2
40 0 2.139 2.313 +8.1
25 22.2 0.946 0.934 -1.3
25 35.0 0.524 0.551 +5.1
25 45.9 0.230 0.221 -4.1
25 56.7 0.073 0.076 +4.3

At 25 °C, 22 wt % of water lowers the solubility by only a sixth. Above 35 % it falls quickly, and at 57 % it is down to about 6 % of the value in absolute ethanol. The crystallizer uses that steep fall.

2. Add the recovery package

Add a second NRTL package named NRTL (ethanol recovery). Enter the same ethanol / water pair, and set the two pairs with ibuprofen to zero (A12 = A21 = B12 = B21 = 0, alpha12 = 0.3). Uncheck the automatic estimation, and leave Handle Solids unchecked.

The fitted pairs are valid from 10 to 40 °C. Near the boiling point of water they give ibuprofen a very large activity coefficient, and the column stops converging. In the recovery package ibuprofen is an ideal heavy compound, which is all the column needs to know: it leaves with the water at the bottom.

3. Specify the feeds

Add these material streams, all at 1.01325 bar:

Stream T (°C) Ibuprofen (kg/h) Ethanol (kg/h) Water (kg/h)
Crude ibuprofen 25 500 0 0
Make-up ethanol 25 0 0.02 0
Make-up water 25 0 0 121
Ethanol return 30 0 504 53.9
Water return 30 28.6 0 484

Ethanol return and Water return are the outlets of the two recycles of step 8. The values above are a first estimate of the ethanol and the water that the column gives back. If you start the recycles from a good estimate, they converge in a few iterations.

4. Dissolve the crude and add the antisolvent

Join Crude ibuprofen, Ethanol return and Make-up ethanol in a Mixer MIX-101 into Dissolver feed, and heat it in a Heater H-101 to 30 °C into Solution, with an energy stream Q H-101. Join Water return and Make-up water in a Mixer MIX-102 into Antisolvent.

From Bioprocess Ops in the palette, add a Crystallizer CRY-101. In its Connections tab, connect Solution to the Feed port and Antisolvent to the Antisolvent (Optional) port, and add the products Crystals and Crystallizer liquor. In the Parameters tab:

Parameter Value
Mode Antisolvent
Solubility Source PropertyPackage
Solute Compound Ibuprofen
Solvent Compound Ethanol
Operating Temperature 25 °C

Parameters of the crystallizer in antisolvent mode

With the property package as the solubility source, the block mixes the two feeds, solves the solubility of ibuprofen in the mixed solvent at 25 °C, and sends the ibuprofen above saturation to the crystals. The coefficients of the correlation and the factor Solubility Reduction by Antisolvent are only used with the correlation, so leave them as they are.

5. Filter and dry the crystals

Join Crystals and Crystallizer liquor in a Mixer MIX-103 into Slurry, and send it to a Filter FT-101 with the outlets Mother liquor (the first one) and Wet cake. Set the calculation mode to Design, the pressure drop to 0.5 bar and the cake moisture to 15 %. In design mode the filter calculates the area it needs from its default cake and medium resistances, so the area is only illustrative.

The dryer is a Heater DRY-101 that takes Wet cake to 50 °C with a pressure drop of 0.41325 bar, down to 0.1 bar, followed by a Gas-Liquid Separator V-101 with the outlets Dryer vapor and Ibuprofen product. A Cooler C-101 condenses the vapor at 10 °C into Dryer condensate, and a Pump P-102 takes it to 1.3 bar as Condensate to the column. The drying tutorial of this section models a real vacuum dryer; here only the solvent balance matters.

6. Recover the ethanol

Pump Mother liquor to 1.3 bar in a Pump P-101 into Liquor to the column, join it with Condensate to the column in a Mixer MIX-104 into Column feed, cold, and heat it in a Heater H-102 to 80 °C into Column feed. Select NRTL (ethanol recovery) as the property package of H-102, of the column and of the streams Column feed, Distillate and Bottoms.

Add a Distillation Column T-101 with 20 stages at 1.01325 bar, Column feed on stage 12, the products Distillate and Bottoms, and the energy streams of the condenser and the reboiler. Set the condenser specification to Product Molar Flow 3.87 mol/s and the reboiler specification to Boilup Ratio 1.5, and select the Naphtali-Sandholm solver.

Specifications of the column

Why Naphtali-Sandholm

The recycles solve the column again at every iteration, each time from the profile of the previous one. The default Wang-Henke solver converges this column the first time, but it fails when the water study of step 10 solves it again. The Naphtali-Sandholm solver converges on every pass.

7. Cool and split the products

Cool Distillate to 30 °C in a Cooler C-102 into Recovered ethanol, and Bottoms to 30 °C in a Cooler C-103 into Cold bottoms. Send Cold bottoms to a Splitter SPL-101 with the split ratios 0.8 for Recovered water and 0.2 for Waste water.

8. Close the loops

Add a Recycle REC-101 from Recovered ethanol to Ethanol return, and a Recycle REC-102 from Recovered water to Water return. In both, select the Wegstein acceleration, set it to act on every iteration, and allow up to 300 iterations.

The solved flowsheet

9. Solve and read the results

Press Solve. The two recycles converge in a few seconds.

Dissolution: the solution carries 0.99 g of ibuprofen per g of ethanol, with 9.6 wt % of water in the solvent. The mixer outlet is at 12.5 °C, colder than both of its feeds, because the crude takes up heat as it dissolves, mostly its heat of fusion. H-101 puts back 19.2 kW to reach 30 °C.

Crystallizer: the Results tab of CRY-101 shows what the water does to the solution:

Result Value
Water in the solvent of the liquor 56.6 wt %
Solubility in the liquor 0.0332 g per g of ethanol
Supersaturation ratio 13.7
Saturation temperature 43.6 °C
Crystals 490.1 kg/h
Crystallized per pass 92.7 %
Crystals in the slurry 29.0 wt %
Heat duty -22.8 kW

Results of the crystallizer

The water brings the solubility down from about 1.1 to 0.033 g per g of ethanol, so the mixed feeds hold 13.7 times what their liquor can keep dissolved at 25 °C. The saturation temperature says that the same mixture would only take all its ibuprofen back into solution above 43.6 °C.

Oiling out

The flowsheet is at equilibrium, so it doesn't see the path of the mixing. The Case Library case shows, with the same model, that a liquid that still holds all the ibuprofen splits into two liquid layers at 25 °C once the water reaches about 36 wt % of the solvent, well before the final 57 %. A real crystallizer adds the water slowly on seeds, so that the crystals grow ahead of the water. If the water goes in too fast, the ibuprofen first separates as an oil.

Filtration and drying: FT-101 needs 2.43 m² of area. The wet cake is 576.6 kg/h with 14.5 wt % of ethanol and water. The dryer takes 49.4 kW, and C-101 removes 43.6 kW when it condenses the vapor.

Ethanol recovery: the column feed is 1199.0 kg/h, and H-102 takes 65.4 kW to bring it to 80 °C. The distillate is 558.1 kg/h with 90.4 wt % of ethanol, and the bottoms are 640.9 kg/h with 35.9 kg/h of ibuprofen. The reboiler takes 573.2 kW and the condenser removes 559.3 kW.

Results of the column

Plant:

Quantity Value
Product 492.9 kg/h, with 0.1 g/h of ethanol and water
Yield of ibuprofen 98.6 %
Ibuprofen lost in the waste water 7.2 kg/h
Fresh ethanol per kg of product 0.04 g
Fresh water per kg of product 0.246 kg
Reboiler duty per kg/h of product 1.16 kW
Mass balance 621.02 kg/h in, 621.03 kg/h out

The crystallizer keeps 92.7 % of the ibuprofen in each pass, and the plant keeps 98.6 %. The difference is the ibuprofen that stays in the liquor: it leaves the column with the bottoms and comes back with the recovered water. Most of it is out of solution once the bottoms are cooled to 30 °C, so it returns to the crystallizer as a suspended solid. The waste water takes its share of it, which is the whole loss of the process.

10. See how much water to add

Change the flow of Make-up water and solve again:

Make-up water (kg/h) Water in the solvent of the liquor (wt %) Crystallized per pass (%) Yield (%) Reboiler (kW)
95 51.2 87.8 97.5 452.9
121 56.6 92.7 98.6 573.2
150 61.5 95.6 99.1 708.6

The water held in the loop is the make-up divided by the purge fraction: with 121 kg/h and a purge of 20 %, about 600 kg/h of water circulates. If you go from 121 to 150 kg/h, the yield gains 0.5 points and the reboiler takes 135 kW more. A designer weighs that against the price of the ibuprofen.

How the Loops Stay in Balance

The water loop: the water of the cake returns to the column with the dryer condensate, so the make-up water leaves only with the waste water. The splitter therefore fixes how much water circulates. If you lower the purge, more water stays in the loop and the yield rises, but more water also goes through the column.

The ethanol loop: the column has a fixed distillate rate, so the ethanol make-up has to equal what leaves the plant. The ethanol leaves only with the product and the waste water, a fraction of a gram per hour, and the make-up is 0.02 kg/h. If the make-up is larger than the losses, the extra ethanol stays in the loop and builds up from one iteration to the next. In the Case Library case, a make-up of 1 kg/h built up until the distillate reached the azeotrope and the column stopped converging. Here the mass balance of the plant closes within 0.01 kg/h.

Range of the model: keep the crystallization section between 10 and 40 °C. According to the Case Library case, the fitted model splits a saturated solution into two liquids at 35 and 40 °C, which agrees with what the measurements showed at 40 °C, and it gives one liquid at 25 and 30 °C. That is why the crystallizer works at 25 °C.

Results and Validation

Expected results

The crystallizer at 25 °C, with 56.6 wt % of water in the solvent of the liquor, crystallizes 92.7 % of the ibuprofen in each pass. The plant makes 492.9 kg/h of product, a yield of 98.6 %, with 0.04 g of fresh ethanol per kg. The column recovers the ethanol at 90.4 wt % with a reboiler of 573.2 kW.

The solubilities come from Rashid et al. (2011): the values in absolute ethanol come from the correlation of the paper, and the others were read from its chart, with an error of about 0.01 g/g. The model follows them within 8 %. The plant itself isn't compared with a measurement. It is the teaching version of the Antisolvent crystallization of ibuprofen from ethanol with water case of the Case Library (cases/separation-processes/ibuprofen-antisolvent-crystallization-ethanol-recovery), which has the same flowsheet and a table of the make-up water from 75 to 150 kg/h.

Automating This Tutorial

The script builds the flowsheet with the FluentAPI, writes the fitted pairs into the two NRTL packages and solves the plant with both loops closed. It compares the model with the measured solubilities, solves the plant at 95 and 150 kg/h of make-up water and back at 121 kg/h, and prints the results of step 9 and the table of step 10. It runs in about a minute. Set DWSIM_SAVE_TO to a file name to save the solved flowsheet.

import os
import sys
import time

import pythonnet
pythonnet.load("netfx")              # DWSIM is a .NET Framework application
import clr  # noqa: E402

DWSIM_BIN = os.environ.get("DWSIM_BIN")
if not DWSIM_BIN:
    raise SystemExit("Set DWSIM_BIN to the DWSIM installation folder before running.")
for sub in ("", "unitops", "ppacks", "extenders"):
    sys.path.append(os.path.join(DWSIM_BIN, sub))
for a in ("DWSIM.Automation", "DWSIM.Automation.FluentAPI", "DWSIM.Interfaces", "DWSIM.Thermodynamics",
          "DWSIM.UnitOperations"):
    clr.AddReference(a)

from System import Array, Double, String  # noqa: E402
from System.Collections.Generic import Dictionary  # noqa: E402
from DWSIM.Automation.FluentAPI import Flowsheet, PropertyPackages, Q  # noqa: E402
from DWSIM.Interfaces.Enums import AccelMethod, FlashSetting  # noqa: E402
from DWSIM.Interfaces.Enums.GraphicObjects import ObjectType  # noqa: E402
from DWSIM.Thermodynamics.PropertyPackages.Auxiliary import NRTL_IPData, SolidSolubility  # noqa: E402
from DWSIM.UnitOperations.UnitOperations import CrystallizerMode, CrystallizerSolubilitySource, Filter  # noqa: E402

IBU, ETOH, H2O = "Ibuprofen", "Ethanol", "Water"
MW = {IBU: 206.281, ETOH: 46.069, H2O: 18.015}
P_ATM = 101325.0

# --- 1. Compounds and the two property packages --------------------------------------------------------------------
fs = Flowsheet.Create("Antisolvent crystallization of ibuprofen with ethanol recovery")
fs = fs.WithCompounds(Array[String]([IBU, ETOH, H2O]))
fs = fs.WithPropertyPackage(PropertyPackages.NRTL).WithPropertyPackage(PropertyPackages.NRTL)
cry_pp, rec_pp = [getattr(p, "__implementation__", p) for p in fs.Inner.PropertyPackages.Values]
cry_pp.Tag = "NRTL + solids (crystallization)"
rec_pp.Tag = "NRTL (ethanol recovery)"


def set_pair(pp, c1, c2, a12, a21, alpha, b12=0.0, b21=0.0):
    """Stores an NRTL pair, tau = (A + B T) / (R T) with A in cal/mol, B in cal/(mol K) and T in K."""
    ip = pp.m_uni.InteractionParameters
    if ip.ContainsKey(c2) and ip[c2].ContainsKey(c1):
        ip[c2].Remove(c1)
    if not ip.ContainsKey(c1):
        ip[c1] = Dictionary[String, NRTL_IPData]()
    pair = NRTL_IPData()
    pair.ID1, pair.ID2 = c1, c2
    pair.A12, pair.A21, pair.B12, pair.B21, pair.alpha12 = a12, a21, b12, b21, alpha
    ip[c1][c2] = pair


for pp in (cry_pp, rec_pp):
    pp.AutoEstimateMissingNRTLUNIQUACParameters = False
    set_pair(pp, ETOH, H2O, -57.9601, 1241.7396, 0.2937)            # the pair of the DWSIM database
# crystallization: ibuprofen pairs fitted to the measured solubilities (10 to 40 C)
set_pair(cry_pp, IBU, ETOH, -3549.744, 6877.817, 0.3, 9.67178, -19.13966)
set_pair(cry_pp, IBU, H2O, -1960.298, -10088.042, 0.2, 30.45368, 66.70384)
cry_pp.FlashSettings[FlashSetting.HandleSolidsInDefaultEqCalcMode] = "True"
# ethanol recovery: ideal ibuprofen pairs, so that the column sees ibuprofen as a heavy compound
set_pair(rec_pp, IBU, ETOH, 0.0, 0.0, 0.3)
set_pair(rec_pp, IBU, H2O, 0.0, 0.0, 0.3)

# --- 2. Streams ----------------------------------------------------------------------------------------------------
STREAMS = ["Dissolver feed", "Solution", "Antisolvent", "Crystals", "Crystallizer liquor", "Slurry", "Mother liquor",
           "Wet cake", "Dryer outlet", "Dryer vapor", "Ibuprofen product", "Dryer condensate",
           "Condensate to the column", "Liquor to the column", "Column feed, cold", "Column feed", "Distillate",
           "Bottoms", "Recovered ethanol", "Cold bottoms", "Waste water", "Recovered water"]
S = {}


def stream(tag, t_c=25.0, p_bar=1.01325, kgh=None):
    s = fs.AddMaterialStream(tag).At(Q.Celsius(t_c), Q.Bar(p_bar))
    for c in (IBU, ETOH, H2O):
        s.SetCompoundMassFlow(c, (kgh or {}).get(c, 0.0) / 3600.0)
    S[tag] = s
    return s


stream("Crude ibuprofen", kgh={IBU: 500.0})
stream("Make-up ethanol", kgh={ETOH: 0.02})
stream("Make-up water", kgh={H2O: 121.0})
# the two tear streams start from an estimate of the recovered ethanol and water
stream("Ethanol return", 30.0, kgh={ETOH: 504.0, H2O: 53.9})
stream("Water return", 30.0, kgh={IBU: 28.6, H2O: 484.0})
for tag in STREAMS:
    stream(tag)
for tag in ("Column feed", "Distillate", "Bottoms"):
    S[tag].Object.PropertyPackage = rec_pp
E = {tag: fs.AddEnergyStream(tag) for tag in ("Q H-101", "Q DRY-101", "Q C-101", "W P-101", "W P-102", "Q H-102",
                                              "Q cond T-101", "Q reb T-101", "Q C-102", "Q C-103")}

# --- 3. Dissolution and antisolvent crystallization -----------------------------------------------------------------
fs.AddMixer("MIX-101").ConnectFeed(S["Crude ibuprofen"], 0).ConnectFeed(S["Ethanol return"], 1) \
  .ConnectFeed(S["Make-up ethanol"], 2).ConnectProduct(S["Dissolver feed"], 0)
fs.AddHeater("H-101").WithOutletTemperature(Q.Celsius(30.0)).ConnectFeed(S["Dissolver feed"], 0) \
  .ConnectProduct(S["Solution"], 0).ConnectEnergyFeed(E["Q H-101"], 1)
fs.AddMixer("MIX-102").ConnectFeed(S["Water return"], 0).ConnectFeed(S["Make-up water"], 1) \
  .ConnectProduct(S["Antisolvent"], 0)
cry = fs.AddCrystallizer("CRY-101")
cry.WithMode(CrystallizerMode.Antisolvent).WithSoluteCompound(IBU).WithSolventCompound(ETOH)
cry.WithSolubilitySource(CrystallizerSolubilitySource.PropertyPackage).WithOperatingTemperature(Q.Celsius(25.0))
cry.ConnectFeed(S["Solution"], 0).ConnectFeed(S["Antisolvent"], 1)
cry.ConnectProduct(S["Crystals"], 0).ConnectProduct(S["Crystallizer liquor"], 1)

# --- 4. Filtration and drying ---------------------------------------------------------------------------------------
fs.AddMixer("MIX-103").ConnectFeed(S["Crystals"], 0).ConnectFeed(S["Crystallizer liquor"], 1) \
  .ConnectProduct(S["Slurry"], 0)
flt = fs.AddFilter("FT-101").WithCalculationMode(Filter.CalculationMode.Design).WithPressureDrop(Q.Bar(0.5)) \
    .WithCakeMoisturePercent(15.0).ConnectFeed(S["Slurry"], 0) \
    .ConnectProduct(S["Mother liquor"], 0).ConnectProduct(S["Wet cake"], 1)
fs.AddHeater("DRY-101").WithOutletTemperature(Q.Celsius(50.0)).WithPressureDrop(Q.Pascal(41325.0)) \
  .ConnectFeed(S["Wet cake"], 0).ConnectProduct(S["Dryer outlet"], 0).ConnectEnergyFeed(E["Q DRY-101"], 1)
fs.AddSeparator("V-101").ConnectFeed(S["Dryer outlet"], 0).ConnectProduct(S["Dryer vapor"], 0) \
  .ConnectProduct(S["Ibuprofen product"], 1)
fs.AddCooler("C-101").WithOutletTemperature(Q.Celsius(10.0)).ConnectFeed(S["Dryer vapor"], 0) \
  .ConnectProduct(S["Dryer condensate"], 0).ConnectEnergyProduct(E["Q C-101"], 0)
fs.AddPump("P-102").WithOutletPressure(Q.Bar(1.3)).ConnectFeed(S["Dryer condensate"], 0) \
  .ConnectProduct(S["Condensate to the column"], 0).ConnectEnergyFeed(E["W P-102"], 1)

# --- 5. Ethanol recovery -------------------------------------------------------------------------------------------
fs.AddPump("P-101").WithOutletPressure(Q.Bar(1.3)).ConnectFeed(S["Mother liquor"], 0) \
  .ConnectProduct(S["Liquor to the column"], 0).ConnectEnergyFeed(E["W P-101"], 1)
fs.AddMixer("MIX-104").ConnectFeed(S["Liquor to the column"], 0).ConnectFeed(S["Condensate to the column"], 1) \
  .ConnectProduct(S["Column feed, cold"], 0)
h102 = fs.AddHeater("H-102").WithOutletTemperature(Q.Celsius(80.0)).ConnectFeed(S["Column feed, cold"], 0) \
    .ConnectProduct(S["Column feed"], 0).ConnectEnergyFeed(E["Q H-102"], 1)
h102.Object.PropertyPackage = rec_pp
col = fs.AddDistillationColumn("T-101").WithNumberOfStages(20).WithTopPressure(Q.Bar(1.01325)) \
    .WithFeed(S["Column feed"], "Stage12").WithDistillate(S["Distillate"]).WithBottoms(S["Bottoms"]) \
    .WithCondenserDuty(E["Q cond T-101"]).WithReboilerDuty(E["Q reb T-101"]) \
    .WithCondenserSpec("Product Molar Flow Rate", 3.87, "mol/s").WithReboilerSpec("Boilup Ratio", 1.5) \
    .WithSolvingMethod("Naphtali-Sandholm").WithMaxIterations(200)
col.Object.PropertyPackage = rec_pp
fs.AddCooler("C-102").WithOutletTemperature(Q.Celsius(30.0)).ConnectFeed(S["Distillate"], 0) \
  .ConnectProduct(S["Recovered ethanol"], 0).ConnectEnergyProduct(E["Q C-102"], 0)
fs.AddCooler("C-103").WithOutletTemperature(Q.Celsius(30.0)).ConnectFeed(S["Bottoms"], 0) \
  .ConnectProduct(S["Cold bottoms"], 0).ConnectEnergyProduct(E["Q C-103"], 0)
spl = fs.AddSplitter("SPL-101").WithSplitRatios(0.8, 0.2).ConnectFeed(S["Cold bottoms"], 0) \
    .ConnectProduct(S["Recovered water"], 0).ConnectProduct(S["Waste water"], 1)

# --- 6. The two recycles close the ethanol and water loops ------------------------------------------------------------
for tag, frm, to in (("REC-101", "Recovered ethanol", "Ethanol return"), ("REC-102", "Recovered water", "Water return")):
    rec = fs.AddUnitOperation(ObjectType.OT_Recycle, tag).ConnectFeed(S[frm], 0).ConnectProduct(S[to], 0)
    r = rec.Object.__implementation__
    r.AccelerationMethod = AccelMethod.Wegstein
    r.WegsteinParameters.AccelFreq = 1
    r.MaximumIterations = 300

fs.AutoLayout()


def solve():
    errors = list(fs.TrySolve())
    if errors:
        raise SystemExit("The flowsheet didn't solve: " + str(errors[0]))


def kgh(tag, compound=None):
    o = S[tag].Object
    if compound is None:
        return o.GetMassFlow() * 3600.0
    return (o.Phases[0].Compounds[compound].MassFlow or 0.0) * 3600.0


def kw(tag):
    return E[tag].Object.EnergyFlow


start = time.time()
solve()
print(f"Solved with both loops closed in {time.time() - start:.0f} s\n")

# --- 7. The model against the measured solubilities ---------------------------------------------------------------------
# g of ibuprofen per g of ethanol in absolute and aqueous ethanol (Rashid et al., 2011): temperature (C), wt % of water in
# the solvent, measured value. The values at 0 % come from the correlation of the paper; the others were read from its chart.
MEASURED = [(10.0, 0.0, 0.600), (25.0, 0.0, 1.138), (40.0, 0.0, 2.139),
            (25.0, 22.2, 0.946), (25.0, 35.0, 0.524), (25.0, 45.9, 0.230), (25.0, 56.7, 0.073)]
cry_pp.CurrentMaterialStream = S["Solution"].Object
names = list(cry_pp.RET_VNAMES())
i_ibu = names.index(IBU)
print("Solubility of ibuprofen in aqueous ethanol, g per g of ethanol")
print(f"{'T (C)':>7}{'water wt %':>12}{'measured':>10}{'model':>8}{'dev %':>8}")
for t_c, w_pct, g_meas in MEASURED:
    n_e, n_w = (100.0 - w_pct) / MW[ETOH], w_pct / MW[H2O]
    solvent = [0.0] * len(names)
    solvent[names.index(ETOH)] = n_e / (n_e + n_w)
    solvent[names.index(H2O)] = n_w / (n_e + n_w)
    cry_pp.CurrentMaterialStream = S["Solution"].Object
    x = SolidSolubility.Saturation(cry_pp, i_ibu, Array[Double](solvent), t_c + 273.15, P_ATM).MoleFraction
    g_model = x * MW[IBU] / ((1.0 - x) * solvent[names.index(ETOH)] * MW[ETOH])
    print(f"{t_c:7.1f}{w_pct:12.1f}{g_meas:10.3f}{g_model:8.3f}{(g_model / g_meas - 1.0) * 100.0:8.1f}")

# --- 8. How much water to add: solve at 95 and 150 kg/h, then back at the design point -----------------------------------
c = cry.Object


def study_row(water):
    liquor_w = kgh("Crystallizer liquor", H2O) / (kgh("Crystallizer liquor", H2O) + kgh("Crystallizer liquor", ETOH))
    return (water, liquor_w * 100.0, c.Result_Yield * 100.0,
            kgh("Ibuprofen product", IBU) / kgh("Crude ibuprofen", IBU) * 100.0, kw("Q reb T-101"))


rows = []
for water in (95.0, 150.0, 121.0):
    S["Make-up water"].SetCompoundMassFlow(H2O, water / 3600.0)
    solve()
    rows.append(study_row(water))

# --- 9. Results at the design point, 121 kg/h of make-up water ------------------------------------------------------
water_solvent = kgh("Crystallizer liquor", H2O) / (kgh("Crystallizer liquor", H2O) + kgh("Crystallizer liquor", ETOH))
print("\nDissolution")
print(f"  Solution                       {kgh('Solution', IBU) / kgh('Solution', ETOH):.2f} g ibuprofen per g ethanol, "
      f"{kgh('Solution', H2O) / (kgh('Solution', H2O) + kgh('Solution', ETOH)) * 100.0:.1f} wt % water in the solvent")
print(f"  Dissolver feed after mixing    {S['Dissolver feed'].TemperatureK - 273.15:.1f} C")
print(f"  H-101 to 30 C                  {kw('Q H-101'):.1f} kW")
print("Crystallizer CRY-101 at 25 C")
print(f"  Water in the solvent of liquor {water_solvent * 100.0:.1f} wt %")
print(f"  Solubility in the liquor       {c.Result_Csat_gg:.4f} g per g ethanol")
print(f"  Supersaturation ratio          {c.Result_Supersaturation:.1f}")
print(f"  Saturation temperature         {c.Result_SaturationT_K - 273.15:.1f} C")
print(f"  Crystals                       {c.Result_Cryst_kgs * 3600.0:.1f} kg/h")
print(f"  Crystallized per pass          {c.Result_Yield * 100.0:.1f} %")
print(f"  Crystals in the slurry         {c.Result_SolidsInSlurry * 100.0:.1f} wt %")
print(f"  Heat duty                      {c.Result_Duty_kW:.1f} kW")
print("Filtration and drying")
print(f"  Filter area FT-101             {flt.Object.TotalFilterArea:.2f} m2")
print(f"  Wet cake                       {kgh('Wet cake'):.1f} kg/h, "
      f"{(1.0 - kgh('Wet cake', IBU) / kgh('Wet cake')) * 100.0:.1f} wt % of ethanol and water")
print(f"  Dryer DRY-101 / condenser C-101 {kw('Q DRY-101'):.1f} / {kw('Q C-101'):.1f} kW")
print("Ethanol recovery T-101")
print(f"  Column feed                    {kgh('Column feed'):.1f} kg/h, H-102 {kw('Q H-102'):.1f} kW")
print(f"  Distillate                     {kgh('Distillate'):.1f} kg/h, "
      f"{kgh('Distillate', ETOH) / kgh('Distillate') * 100.0:.1f} wt % ethanol")
print(f"  Bottoms                        {kgh('Bottoms'):.1f} kg/h, {kgh('Bottoms', IBU):.1f} kg/h of ibuprofen")
print(f"  Reboiler / condenser           {kw('Q reb T-101'):.1f} / {kw('Q cond T-101'):.1f} kW")
product = kgh("Ibuprofen product")
print("Plant")
print(f"  Product                        {product:.1f} kg/h, "
      f"{(product - kgh('Ibuprofen product', IBU)) * 1000.0:.1f} g/h of ethanol and water")
print(f"  Yield                          {kgh('Ibuprofen product', IBU) / kgh('Crude ibuprofen', IBU) * 100.0:.1f} %")
print(f"  Ibuprofen in the waste water   {kgh('Waste water', IBU):.1f} kg/h")
print(f"  Fresh ethanol / water per kg   {kgh('Make-up ethanol') / product * 1000.0:.2f} g / "
      f"{kgh('Make-up water') / product:.3f} kg")
print(f"  Reboiler per kg/h of product   {kw('Q reb T-101') / product:.2f} kW")
feeds = kgh("Crude ibuprofen") + kgh("Make-up ethanol") + kgh("Make-up water")
print(f"  Mass balance                   in {feeds:.2f}, out {product + kgh('Waste water'):.2f} kg/h")

print("\nMake-up water against yield and reboiler duty")
print(f"{'water kg/h':>11}{'water wt %':>12}{'per pass %':>12}{'yield %':>9}{'reboiler kW':>13}")
for row in sorted(rows):
    print(f"{row[0]:11.0f}{row[1]:12.1f}{row[2]:12.1f}{row[3]:9.1f}{row[4]:13.1f}")

out = os.environ.get("DWSIM_SAVE_TO")
if out:
    fs.Save(out)
    print(f"\nSaved to {out}")

Output may vary

Results depend on the LLM's reasoning quality and tool-use accuracy. Always verify the simulation matches your intent before relying on the numbers.

In the DWSIM Assistant, build the following simulation:

- Compounds Ibuprofen, Ethanol and Water
- Property package 1, NRTL "NRTL + solids (crystallization)", with
  solids handled in the flash and without automatic estimation of
  missing pairs. Pairs (A in cal/mol, B in cal/(mol K)):
  Ibuprofen/Ethanol A12 -3549.744, A21 6877.817, B12 9.67178,
  B21 -19.13966, alpha 0.3; Ibuprofen/Water A12 -1960.298,
  A21 -10088.042, B12 30.45368, B21 66.70384, alpha 0.2;
  Ethanol/Water A12 -57.9601, A21 1241.7396, alpha 0.2937
- Property package 2, NRTL "NRTL (ethanol recovery)", with the same
  Ethanol/Water pair and the ibuprofen pairs at zero with alpha 0.3
- Crude ibuprofen 500 kg/h at 25 C, make-up ethanol 0.02 kg/h,
  make-up water 121 kg/h
- Dissolve the crude in the recovered ethanol, heat to 30 C, and
  crystallize in a Crystallizer in antisolvent mode at 25 C with the
  solubility from the property package, solute Ibuprofen, solvent
  Ethanol, and the recovered water plus the make-up as antisolvent
- Filter the slurry (design mode, 0.5 bar, 15 % cake moisture), dry
  the cake at 50 C and 0.1 bar, and condense the dryer vapor at 10 C
- Send the mother liquor and the condensate at 1.3 bar through a
  heater to 80 C and a 20-stage column at 1.01325 bar (feed on stage
  12, distillate 3.87 mol/s, boil-up ratio 1.5, Naphtali-Sandholm),
  both with package 2
- Cool the distillate to 30 C and return it to the dissolver; cool the
  bottoms to 30 C, purge 20 % and return the rest as antisolvent, with
  Wegstein recycles
- Report the product flow, the yield, the crystallizer results and the
  reboiler duty

Exercises

  1. Lower the purge of SPL-101 to 10 % and keep the make-up water at 121 kg/h. How much water circulates now, and what happens to the yield and to the reboiler duty?
  2. Run the crystallizer at 20 °C. How much does the yield per pass change, and why is it a smaller effect than adding water?
  3. Raise the make-up ethanol to 1 kg/h and solve. Watch the distillate and the recycle REC-101 over the iterations, and explain what you see.
  4. Replace the ideal ibuprofen pairs of the recovery package with the fitted ones, and solve the column again.

Further Reading

  • A. Rashid, E. T. White, T. Howes, J. D. Litster and I. Marziano. (2011). Crystallization kinetics of ibuprofen from ethanol and aqueous ethanol. 10th International Conference on Chemical and Process Engineering (ICheaP-10)
  • A. Rashid, E. T. White, T. Howes, J. D. Litster and I. Marziano. (2014). Effect of solvent composition and temperature on the solubility of ibuprofen in aqueous ethanol. Journal of Chemical & Engineering Data, 59, 2699-2703
  • I. Hahnenkamp, G. Graubner and J. Gmehling. (2010). Measurement and prediction of solubilities of active pharmaceutical ingredients. International Journal of Pharmaceutics, 388, 73-81
  • A. S. Myerson, D. Erdemir and A. Y. Lee. (2019). Handbook of Industrial Crystallization, 3rd ed. Cambridge University Press
  • DWSIM User Guide: the Crystallizer and the Solubility and Solvent Screening tool

Next Steps

You now know how an antisolvent crystallizes a product without cooling, and what it costs to get the solvent and the antisolvent back. Continue with the next tutorial of the pharmaceutical processes section, where a column replaces one solvent with another before a cooling crystallization.