However, if you're only whipping unhappy citizens, you don't have to pay the opportunity cost. Instead, you have to pay an additional 2

per turn. On the one hand, if 2

per turn is worth more than the opportunity cost, then why did you grow that big to begin with? There's no need to worry about the happy cap.
On the other hand, if 2

is worth less than the opportunity cost, you should whip only after you reach the cap.
I wouldn't expect the opportunity cost to be better than 2

very often. Remember, as a rule we are whipping citizens off of our worst tile(s), so the opportunity cost is going to be low.
To some extent, you can approximate an unhappy citizen by thinking of it working a 0/0/0 tile.
But lets step back a bit. Consider a city at 35/36 - that's size 8, and let's set the happy cap there. Food surplus is +5. Because this is an illustration, rather than an example, we'll pretend that there's no granary.
Q: if we again grow at +5 food, where does the food bar end up?
A: 4/38.
In other words, although we have an unhappy citizen now, he hasn't actually eaten any food yet. There hasn't been any waste - waste only appears when you hit end turn with an unhappy citizen.
So you can work 8 tiles on turn 0, and then 7 tiles for 10 turns (assuming you can keep growth in check - training a worker or a settler or something).
The "traditional" approach works 6 tiles on turn 0, then 7 tiles for 9 turns... Aha, there's one more turn here where the old approach can work an 8th tile where you are stuck working 7 tiles.
Net profit - one 7th best tile?
Net loss - it's sort of hidden here, but it's basically the lower of your two food, and the value of the food gap if you don't grow a turn early. Example - At turn 9, both strategies are at 33/34. The early whip approach doesn't need to worry about the unhappy, so it can grow to 4/36 on T10, then 9/36 on T11. The late whip approach either works an unhappy citizen (4/36 then 7/36) OR parks an extra turn (33/34, 4/36)... it's 5 food "behind" but presumably it got some compensation for this.
One way where things have the potential to get very interesting is the situation where you are going to be whipping out workers or settlers. To avoid the penalty, you'll of course want to invest one turn of work into them before the whip. Growth will be stagnant on that turn, etc.
BUT... unhappy citizens don't eat food (
EDIT: when training a worker or settler). So you would still have 5F contributing on that build, and you'll get it back in overflow hammers. So you can beat the game, kind of.
(Of course, the early whip approach can use the same trick - I don't think you come out ahead)
The other hidden cost that you need to pay attention to is the starting point - You need to grow, so the minimum food bar to start with (again, assuming +5F) is 31/36.
The earlier whip doesn't need nearly so much - he doesn't need 36 food to grow to size 9 right away, but instead 32 food to grow to size 7. So that approach can start as early as 27/36.
With a granary in place, the analysis gets messy, because you have two extra food to throw away! Growing from size 8->9, you get 18 food from the granary; growing from 6->7, you only get 14 food. So you can break even on food, by working the same tiles as the early whip case, and come out a full 7th best tile profit ahead.
Unfortunately, you get badly rooked on the fact that you have to start at 31/36, which basically means that you need 14 food after you grow to size 8, where the early whipping cycle needs only 10 food to get back to the lower sweet spot.
A complete analysis is more work, as you have to have a good answer to the question "what am I doing with tile assignments to assure that I'm not wasting food", but I hope you'll find that the simplifications here clarify the problem.