My condolences for your loss. My paternal grandfather passed away when I was on my second class sea year. His passing coincided with the end of my assignment to my last ship as a cadet, so I was able to arrive home on the morning of his funeral. I have a feel for what you are going through.
As others have said, this is one of the hard parts about going to sea.
The ship will not divert from the intended voyage for this situation.
I assume that you have been able to notify your DS via email or satellite telephone about the situation. If not, contact KP so that the ATR can assist you with the notification. The ship should have some type of satellite telephone so that your DS can speak to you. Also, find out what the policy is for repatriating midshipmen in these situations.
MSC and the Navy use the American Red Cross to verify family emergencies for deployed mariners. This verification is helpful for the ship in making the decision to repatriate someone from overseas. Contact the local chapter and they will have info on what their policy is for this type of notification. I don't know if they can send notification to a commercial ship or not.
If the ship's schedule lines up correctly so that travel home for the funeral is an option, then the ship can start having their agent in the port in question arrange for travel before the ship gets into port, if that is what you decide to do.
When faced with these situations on the ship, I will usually say "the outfit has 50 ships and you have one family. Take care of your family first. The ships will still be out here when you return."