Design Optimization Of Acoustic Metamaterials And Phononic Crystals With A Time Domain Method