/3x3_metasurface

Builds a custom dataset of 3x3 meta-atom pillars using MIT's electromagnetic simulation software, meep.

Primary LanguagePython

3x3_metasurface

This is the codebase for building the custom dataset used for the study presented in the publication, Time-series neural networks to predict electromagnetic wave propagation.


Running from a local Docker container

A library of 3x3 pillar radii between 75 nm and 250 nm is generated using generate_radii.py. This generates a file called neighbors_library_allrandom.pkl. This file stores a numpy array with len(5000). Each index contains a list of 9 radii.

Running main.py allows the user to either generate data or reduce the data into volumes, as presented in the paper linked above.

  1. Generate data. To run a single simulation:

    • Set the config file parameter, task to 0.
    • Create an instance of the Docker image, v3_lightning.
    • From /develop/code/3x3_metasurface, run:
      mpirun --allow-run-as-root -np {num_cpu_cores} python3 main.py -config configs/config.yaml -idx {neighbors library index}
      
  2. Reduce data.

    • Set the config file parameter, task to 0.
    • Running the same Docker container in (1), from /develop/code/3x3_metasurface, run:
      python3 reduce_data.py
      

Using Kubernetes

  1. Generate data. To launch many simulations:
  • Set the config file parameters.
    • task : 0
    • deployment_mode : 1
    • kube.datagen_job.num_sims : 1500
    • kube.datagen_job.start_group_id : 0
    • kube.datagen_job.num_parallel_ops : {your preference}
  • Running an instance of the Docker image, kubernetes launcher, navigate to kubernetes/gen_data/ and run
    python3 launch_jobs.py
    
  1. Reduce data.
  • Set the config file parameters.
    • task : 1
    • deployment_mode : 1
  • From kubernetes/reduce_data, run:
    python3 launch_jobs.py