It's in submarine\sub_class\sub-class.cfg file: there are periscope, crash and max depth values specified. First red line on depth gauge is peri depth, second --crash depth, with max depth set deeper than crash - its how deeper, below crush depth you can go before game will consider collapsing or telescoping your hull