@beerwright/core
    Preparing search index...

    Function solveAdditionsForTargetPh

    • Solve for the dose of one acid or alkali that hits a target mash pH.

      We bisect on the dose and re-run predictMashPh at each step, so the answer is self-consistent: feed the returned amount back into predictMashPh and you get the target. We prefer that to a faster method. The inner solve is a 23-step bisection on a closed-form expression, so a full outer solve is ~50 inner solves and still runs in well under a millisecond.

      Converges to convergenceTolerancePh (default 1e-6 pH) or maxIterations, whichever comes first. The upper bracket starts at INITIAL_DOSE_PER_LITRE (0.2 mL or g per liter of mash water) and doubles until the target is crossed or the MAX_DOSE_PER_LITRE ceiling (100 per liter) is hit. A target beyond the ceiling is reported as unreachable instead of being clamped.

      Parameters

      Returns MashPhSolution