A method for determining an optimized purge gas flow in a semi-conductor inspection metrology or lithography apparatus, comprising: accepting, using a processor, a first input identifying a position of at least one input port for a semi-conductor inspection metrology or lithography apparatus; or identifying, using a processor, a position of at least one input port for a semi-conductor inspection metrology or lithography apparatus; accepting, using the processor, a second input identifying a position of at least one output port for the semi-conductor inspection metrology or lithography apparatus; or identifying, using the processor, a position of at least one output port for a semi-conductor inspection metrology or lithography apparatus; identifying, using the processor: at least one desorption surface (212, 214) in the semi-conductor inspection metrology or lithography apparatus; a desorption rate associated with the at least one desorption surface; and, a contaminant (208, 209) released from the at least one desorption surface; identifying, using the processor, at least one purge gas flow path, through the semi-conductor inspection metrology or lithography apparatus for a purge gas; calculating, using the processor and the respective identifications of the at least one desorption surface, the desorption rate, and the released contaminant, at least one minimum velocity and flow rate for a flow of purge gas, from the position of the at least one input port across the at least one desorption surface to the position of the at least one output port, sufficient to transport the released contaminant from a vicinity of the at least one desorption surface to the at least one output port; introducing the purge gas into the semi-conductor inspection metrology or lithography apparatus through the at least one input port with the at least one optimized gas velocity and gas flow rate; and, transporting the released contaminant from the vicinity of the at least one desorption surface to the at least one output port. accepting, using a processor, a first input identifying a position of at least one input port for a semi-conductor inspection metrology or lithography apparatus; or identifying, using a processor, a position of at least one input port for a semi-conductor inspection metrology or lithography apparatus; accepting, using the processor, a second input identifying a position of at least one output port for the semi-conductor inspection metrology or lithography apparatus; or identifying, using the processor, a position of at least one output port for a semi-conductor inspection metrology or lithography apparatus; identifying, using the processor: at least one desorption surface (212, 214) in the semi-conductor inspection metrology or lithography apparatus; a desorption rate associated with the at least one desorption surface; and, a contaminant (208, 209) released from the at least one desorption surface; at least one desorption surface (212, 214) in the semi-conductor inspection metrology or lithography apparatus; a desorption rate associated with the at least one desorption surface; and, a contaminant (208, 209) released from the at least one desorption surface; identifying, using the processor, at least one purge gas flow path, through the semi-conductor inspection metrology or lithography apparatus for a purge gas; calculating, using the processor and the respective identifications of the at least one desorption surface, the desorption rate, and the released contaminant, at least one minimum velocity and flow rate for a flow of purge gas, from the position of the at least one input port across the at least one desorption surface to the position of the at least one output port, sufficient to transport the released contaminant from a vicinity of the at least one desorption surface to the at least one output port; introducing the purge gas into the semi-conductor inspection metrology or lithography apparatus through the at least one input port with the at least one optimized gas velocity and gas flow rate; and, transporting the released contaminant from the vicinity of the at least one desorption surface to the at least one output port.