Effect of constraint on mechanical behavior of polymer layers and membranes in energy applications