Fabrication of rigid polyimide foams with overall enhancement of thermal and mechanical properties