There is a Pasuk from פרשת נח that needs explanation. ויהי לשבעת הימים ומי המבול היו על הארץ, that at the end of seven days, the flood was upon the land.
The Yerushalmi explains that there was a seven day mourning period for מתושלח, who had passed away. This is a רמז, a hint, that the mourning for a loved one is seven days. This would be called an אסמכתא, or something we rely on that there is a source for Shiva from the Torah.
The תורה תמימה says that the nature of Hashem is different from man. Hashem mourns for the tragedy seven days before it happens. Man, on the other hand, begins to mourn after the death of a loved one. Hashem knows the future so he mourns before. Man is left uncertain of the future.
All of this is learned from the strange Pasuk telling us the flood took place after seven days.