It is very normal for pH to change over time in the mash and where acid (as from the roast barley in you stout or sauermalz in a lighter beer) is involved for it to increase. I believe the acid gets released rather quickly from the acidic malts and then takes a while to be absorbed by the base malts - just a theory. What does seem strange is a mash pH as low as even 5.22 for a typical dry stout (10% roast barley) in water with any reasonable alkalinity. Most of the reports I have seen here and on other sites indicate that 5.5 is more likely. That, BTW, is what I get every time I brew such a beer. Was there something unusual in your grist such as a high percentage of roast barley (20% gives me pH 5.2 in lab experiments).
I was purposefully targeting a pH of 5.2 using DI water built up based on Bru'n Water for my mash water volume and grain bill targeting Ireland's Wicklow Mtn water except I went for higher calcium in the profile (46ppm). For more clarity here are my water additions and grain bill for 6G DI mash water (no sparge as doing BIAB). All water amendments were added prior to dough in:
Gypsum: 2.4g
Epsom Salt: 0.6g
NaCl non iodize: 0.6g
Calcium Cl: 1.8g
Phos Acid 10%: 30ml
Grain bill:
5.49# Maris Otter
2.06# Flaked Barley (1.7 SRM)
0.43# Roasted Barley (300 SRM)
0.26# Dehusked Carafe III (677 SRM)
Target mash temp was 152F striking at 158.6F
My plan was to hold back roasted barley and dehusked Carafe III until last 10 min of mash so I could increase final beer color while reducing roast flavor from my first attempt at this recipe. My last Guinness clone (and first attempt at this recipe) the final product was a tad bit roasty'er than I remember the Guinness over in Dublin in June. My first attempt also turned out more of a dark amber vs a very deep almost black ruby, so, replaced some of the roast with dehusked Carafe III and going with a late mash addition or so I'd planned. I'm hoping adding the Carafe III early being dehusked/debittered won't have that big of a flavor impact.
10 min after mashing in Maris Otter and Flaked barley my mash temp was still at 154F. My fear of leaving at 154F for very long would allow the beta amylase a leg up over the alpha amylase. In an attempt to quickly lower temp another degree I decided to dough in the Carafe III at 10 min in. This lowered the temp to 151F. Knowing I had a long mash ahead and would lose 3-4F I put a bit of heat back on the mash getting it to 153F. Good enough, so, covered my kettle with sleeping bag and let it go.
Since I pulled my first pH sample at t+20min the Carafe III had only been in the mash 10 min. I was expecting the reading to be above 5.2 at this point since the Carafe hadn't had a chance to "do it's thing". When the pH reading came in at 5.08 I was very surprised. Based on AJ's response above maybe the Carafe III had done a big acid dump in those 10 min and the pale malts hadn't absorbed it yet?
If that's the case this brings up a questions if one is holding the roasted malts until late in the mash. How should that be accounted for in a tool such as Bru'n Water?