add function to calculate layer thickness