Cold traps are normally used to purify sodium, and their principle of operation is to cool sodium to temperature near its melting point, where soluble impurities contained in it are easy to precipitate. Two mathematical models are developed to analyze the processes that occur in sodium cold trap. One of them is used to analyze optimal passway shape of air cooler and the other is used to analyze optimal management of Stainless steel mesh. The models for analyzing optimal performance of sodium cold trap are typical optimal control problems. The problem are solved by means of Generalized Pontryagin's Minimum Principle. The numerical results show that air cooler of a cold trap should be two zones, that is, one is cooled by air and the other one is held in isothermal situation. The passway shape of air cooler should be a variable across section when performance of cold trap is optimal. The mesh management of a cold trap should be small surface in top and large surface in bottom when its precipitating performance is optimal and its working period is longer. The obtained conclusions are useful for practical engineering design and operation of a cold trap.