Hi and thanks for the query,
is a non steroidal anti inflammatory drug, and in course of its anti inflammatory effect, reduces secretion of mucus in the stomach that protects against the erosive actions of gastric acid
. Taken with water however reduces this risk. The pain that you are feeling is certainly due to the gastric irritation of the Ibuprofen, may be because you took it late and its worth knowing whether you had eaten or not. It advisable to take non steroidal anti inflammatory drugs after meals to reduce these side effects. If effects are really that serious, it might be a good idea always informing your doctor all the time that you have gasric pain when you take anti inflammatory drugs. taking it with water might have reduces the risk of developing the pain, but its not definitive. Even with water and food, some people sensitive to Ibuprofen still end up with pain, especially when taken in large doses.
Thanks and best regards,