Actually, the best way to do this is with a spreadsheet.
For instance, I needed an accurate way to size round-bottom chemical reaction vessels so I wrote a spreadsheet where I input the desired volume and diameter. On the output side I get 1/2 the volume of the sphere used for the bottom, which the spreadsheet subtracts from the total desired and gives me the height of the corresponding cylinder required for the total volume.
Then it’s just a matter of drawing an Arc S-E-D, a Line up, Join, Offset to the outside by glass thickness, close the curve top and revolve. For liquid, you would offset the inside curve by, say .001, Revolve and Cap the planar top.
With some thought, you can pretty much size volumes accurately using math and solid primitives. If you need to do this a lot, it’s better to write a function. I imagine it could be done in GH and if I had experience in GH it’d be worth a shot.