---
url: /dyad/stable/examples/CoffeeMugDemo.md
---

# Coffee Mug Demo {#Coffee-Mug-Demo}

Download this exampleCoffeeMugDemo.zipFull project — Dyad model + Julia + data›

A thermal model of an espresso cooling in a porcelain mug, built with Dyad. It captures convection, conduction, and radiation across interacting subsystems — the coffee, the mug, a hand, the rising steam, and an optional metal spoon.

## The model {#The-model}

`EspressoCupSystemModular` connects the coffee-mug, steam, and hand subsystems to a fixed-temperature ambient environment:&#xA;

## Running it {#Running-it}

Simulate the espresso cooling over 6000 s and plot the espresso temperature:

```julia
using CoffeeMugDemo, ModelingToolkit, DyadInterface, Plots

@named model = EspressoCupSystemModular()
res = TransientAnalysis(; model, alg = ODEAlg.Auto(),
                        abstol = 10e-3, reltol = 1e-3, start = 0.0, stop = 6000)
plot(res, idxs = [model.coffeeMug.espressoTemp_degC])
```

![](nfpjdqn.svg)
