Calculate the amount of memory used


I am running the simulation to compute the permeability of a 3D Porous Medium. My sample dimensions are 1232x1197x1197. It seems that it is using a considerable amount of memory as the job submitted to the cluster is rejected. I downsized the sample to 50% and now it is running. I would like to know how to calculate the amount of memory the simulation uses knowing the size of the sample.

Thanks in advance