Every number in this app comes out of a physiological simulation
that runs your logged food and activity forward in five-minute steps. Here is what
is in it, where the figures come from, and where it is weakest.
1. How the simulation runs
Your body is modelled as four connected stores plus a gut. Every five minutes the
engine works out how much food has been absorbed, how much energy you are spending,
what mix of fat and carbohydrate that spend is drawn from, which store each part comes
out of, and where any surplus goes. It replays your whole logged history each time,
then projects 24 hours forward on the assumption you eat nothing more.
2. Compartment sizes
| Store | Sizing rule | Yours |
| Blood / extracellular glucose | 0.20 L per kg body weight, held at 90 mg/dL | |
| Liver glycogen | 1.40 g per kg body weight | |
| Muscle glycogen | 8.0 g per kg lean mass | |
| Fat | body-fat % × weight, at 7700 kcal/kg | |
Liver glycogen 65-120 g with the liver at 6-8% glycogen by wet
weight; muscle glycogen ~150 mmol/kg wet weight, 300-700 g in total, scaling with lean
mass; adipose tissue 7200-7700 kcal/kg depending on assumed lipid fraction.
Why muscle is separate. Skeletal muscle has no glucose-6-phosphatase, so it
cannot dephosphorylate glucose-6-phosphate and export glucose. Its glycogen fuels only
the muscle storing it. This single fact is why the muscle tank behaves nothing like
the liver, and it is what most "calorie battery" models get wrong.
3. Resting energy expenditure
Primary equation is Katch-McArdle, BMR = 370 + 21.6 × lean mass (kg),
chosen because the app asks for body-fat percentage and lean-mass equations beat
weight-based ones when that is known, markedly so in lean or muscular people.
Mifflin-St Jeor is shown alongside it as a cross-check.
Activity multipliers run 1.20 (desk-bound) to 1.68 (very active) and cover
non-exercise movement only. Logged workouts are added separately from MET values
(2011 Compendium of Physical Activities), with one MET subtracted so resting burn
is not counted twice.
Thermic effect of food: carbohydrate 8%, protein 25%, fat 3%. Standard
activity multipliers already bake in an average TEF, so the engine holds back a 10%
allowance and charges each meal's actual thermic cost as it absorbs. A fasting day
therefore correctly costs about 10% less than an eating day, which a flat multiplier
cannot express.
4. Digestion
Each meal empties on a gamma (shape 2) curve, one per macronutrient: carbohydrate
with a mean transit of 36 minutes (fast) to 90 (slow), protein 150, fat 240. Large meals
empty more slowly, and fat in a meal slows everything alongside it. Carbohydrate uptake
is capped at 1.6 g/min, reflecting the SGLT1 ceiling.
5. Which fuel gets burned
The carbohydrate share of resting energy is calibrated directly against published
respiratory-quotient data:
| Hours since eating | Model | Published |
| Fed, at peak | 0.81 | 0.75-0.85 |
| 4 h | 0.53 | ~0.47 |
| 12 h | 0.26 | ~0.33 |
| 24 h | 0.15 | 0.20-0.30 |
| 48 h | 0.08 | 0.10-0.15 |
| 72 h | 0.07 | 0.05-0.10 |
During exercise the mix follows the crossover concept: carbohydrate share rises
with intensity as a fraction of your aerobic ceiling, scaled down when muscle glycogen
is low.
Obligate glucose. Whatever the mix says, the brain needs glucose: about
5 g/hr, plus 1 g/hr net for red cells and renal medulla. As ketones take over that
demand falls, to roughly 30-40% of brain fuel at three days, 60-75% after three
weeks. This is the floor the liver has to defend.
6. Serving the demand, in order
- Exercising muscle burns its own glycogen first.
- Resting muscle burns its own too: a share of peripheral demand while insulin
is around, plus a slow turnover that continues during a fast. Muscle glycogen is
spared, not inert: it falls ~5% over a day of fasting and about a third over three.
- Blood glucose covers the rest.
- The liver restores the blood setpoint. Hepatic glucose output is a blend of
glycogen breakdown and gluconeogenesis from the very first hours, not a switch that flips,
roughly 30% gluconeogenesis at 4 h, 50% at 12 h, over 90% at 48 h. Its substrate is
glycerol from fat plus amino acids, and it costs 25% extra energy.
- Fat covers everything left.
7. Storage gets first claim
This ordering matters more than any other detail. Roughly 65-75% of an oral glucose
load is stored rather than oxidised in the hours after a meal: portal blood
reaches the liver before anything else, and insulin-driven GLUT4 translocation pulls
glucose into muscle. Only what storage does not take raises your systemic blood sugar.
Glycogen synthesis is rate-limited, not instantaneous: about 0.55 g/min for the
liver and 0.85 g/min for resting muscle at full insulin. Hepatic first-pass extraction
scales with depletion, from 24% when the liver is full to 72% when it is empty, because
a depleted liver is a powerful glucose sink. After exercise, muscle glucose uptake is
transiently insulin-independent and several times faster, with a four-hour half-life.
Storing carbohydrate as glycogen costs 5%. Converting it to fat costs 25%, and only
happens once both tanks are full, which is why ordinary carbohydrate meals rarely turn
into body fat directly.
8. Setting your starting tanks
A new account has nothing logged, so the tanks are estimated from your onboarding
answers: habitual carbohydrate intake sets the level you live at (keto-adapted muscle
sits near 40% of capacity, ordinary mixed eating near 80%, carb-loading near full) and
a recent hard session knocks muscle glycogen down by roughly half, refilling over
24-48 hours. The engine then replays 36 hours of that pattern so the liver, insulin
and fat adaptation settle where the physiology puts them rather than at a constant.
9. How it is checked
Two test suites ship with the app. docs/selftest.php runs 24 checks
against published physiology with no database needed; docs/selftest-db.php
adds 12 on the simulator itself. Between them they verify:
- Liver glycogen across a 72-hour fast: 73% at 12 h, 46% at 24 h, 19% at 48 h, 6% at 72 h.
- Energy from fat: 61% at 12 h, 71% at 24 h, 77% at 48 h, 80% at 72 h.
- Muscle glycogen spared but not frozen: 71% remaining at 72 h.
- Post-meal blood glucose peaking near 125 mg/dL at 75 minutes.
- Eating at maintenance holds fat mass flat across 14 simulated days, to within
about 25 g per week.
- Seeding never leaves invented food in the gut, and with nothing logged every
store falls monotonically.
10. Where it is weakest
- No adaptive thermogenesis. Metabolism falls during a sustained deficit and
the model does not capture that, so long deficits read slightly optimistic. Logging
your weight is what keeps it honest.
- Deep-fast fat share runs a few points low beyond about 36 hours, because
muscle turnover and brain glucose both count as carbohydrate oxidation.
- Muscle glycogen is one pool, not per muscle group. A leg day and an arm day
drain the same tank.
- No ketone compartment. Ketosis is represented by a fasting-adaptation
variable and its effect on brain glucose demand.
- Individual variation is large in every parameter here: liver size, glycogen
capacity, absorption speed, substrate preference. Treat the shapes and the timing as
useful and the exact figures as estimates.
- A deficit measured in intake is always a smaller deficit measured in expenditure,
because eating less also lowers the thermic effect of food. Expect roughly three
quarters of what the naive kcal ÷ 7700 arithmetic predicts.
Sources
- Cahill GF. Starvation in man. N Engl J Med, 1970. Fasting fuel sequence, brain glucose.
- Owen OE et al. Brain metabolism during fasting. J Clin Invest, 1967. Ketone substitution.
- Nilsson LH, Hultman E. Liver and muscle glycogen across fasting and refeeding.
- Mifflin MD et al. AJCN, 1990. Resting energy expenditure equation.
- Katch & McArdle. Lean-mass based BMR.
- Boirie Y et al. PNAS, 1997. Slow versus fast dietary protein absorption.
- Jeukendrup AE. Sports Med, 2010. Intestinal carbohydrate absorption ceilings.
- Brooks GA. The crossover concept for exercise substrate use.
- Acheson KJ et al. AJCN, 1988. Glycogen storage capacity and de novo lipogenesis.
- Alpert SS. Metabolism, 2005. Maximum rate of energy release from fat stores.
- Ainsworth BE et al. The 2011 Compendium of Physical Activities (MET values).
- Hodgdon & Beckett, Naval Health Research Center, 1984. Circumference body-fat equations.
- Zuntz & Lusk. Respiratory quotient to substrate-oxidation tables.
Full parameter list, every formula and the calibration record are in
docs/MODEL.md in the source.