For a project, I need to know the critical density value which is being used by the simulation to calculating M200 and R200 at z=0. I attempted to calculate it on my own using M200 and R200, but I obtained a value of approximately 4e-26 kg/m^3, which is about four times the approximate critical density which is accepted elsewhere. Is this figure correct?
I get 1.27e11 msun/mpc^3 for the TNG cosmology, i.e. 8.6e-27 kg/m^3.
I found critical densities equal to yours and I know how to compute them from theory.
But I was wondering which formula you use to compute the mean density. In my case I found 2.66e-27 kg/m^3.
This doesn't have anything to do with TNG in particular. You can look at any piece of code or package which computes cosmology-related quantities.