def velocity_initial_conditions(self, hx, hy, shape): velocity = self.vel return velocity def density_initial_conditions(self, hx, hy, shape): rho = 1.0 return rho def __init__(self, *args, **kwargs): super(ChannelDomain, self).__init__(*args, **kwargs) class EmptyTrainer(Trainer): domains = [ChannelDomain] network = None @classmethod def update_defaults(cls, defaults): defaults.update({ 'visc': 0.01, 'domain_name': "channel", 'run_mode': 'generate_data', 'mode': 'visualization', 'lb_to_ln': 128, 'max_sim_iters': 40000}) if __name__ == '__main__': sim = LatNetController(trainer=EmptyTrainer) sim.run()
from controller import LatNetController from network_architectures.standard_network import StandardNetwork import numpy as np import cv2 import glob class LDCSimulation(Simulation): script_name = __file__ network = StandardNetwork domain = LDCDomain #domain.sim_shape = [1024, 1024] domain.sim_shape = [256, 256] @classmethod def update_defaults(cls, defaults): defaults.update({ 'latnet_network_dir': './network_save', 'run_mode': 'eval', 'visc': 0.001, 'lb_to_ln': 256, 'input_cshape': '256x256', 'input_shape': '512x512', 'max_sim_iters': 1600 }) if __name__ == '__main__': sim = LatNetController(simulation=LDCSimulation) sim.run()
sys.path.append('../latnet') from domain import Domain from controller import LatNetController from trainer import Trainer from network_architectures.les_network import LESNet import numpy as np import cv2 import glob class TempoGanTrainer(Trainer): script_name = __file__ network = LESNet domains = [LESDomain] @classmethod def update_defaults(cls, defaults): defaults.update({ 'train_sim_dir': './train_data', 'latnet_network_dir': './network_save', 'visc': 0.001, 'lb_to_ln': 8, 'input_cshape': '64x64', 'max_sim_iters': 1600 }) if __name__ == '__main__': sim = LatNetController(trainer=TempoGanTrainer) sim.run()
from trainer import Trainer from network_architectures.standard_network import StandardNetwork import utils.binvox_rw as binvox_rw import numpy as np import cv2 import glob class StandardTrainer(Trainer): script_name = __file__ network = StandardNetwork domains = [LDCDomain] @classmethod def update_defaults(cls, defaults): defaults.update({ 'train_sim_dir': './train_data', 'latnet_network_dir': './network_save', 'visc': 0.001, 'lb_to_ln': 256, 'train_autoencoder': True, 'seq_length': 5, 'input_cshape': '32x32', 'max_sim_iters': 1000 }) if __name__ == '__main__': sim = LatNetController(trainer=StandardTrainer) sim.run()
from domain import Domain from controller import LatNetController from simulation import Simulation from network_architectures.tempogan_network import TempoGAN import numpy as np import cv2 import glob class TempoGanSimulation(Simulation): script_name = __file__ network = TempoGAN domain = ChannelDomain domain.sim_shape = [256, 256] @classmethod def update_defaults(cls, defaults): defaults.update({ 'run_mode': 'eval', 'latnet_network_dir': './network_save', 'visc': 0.01, 'lb_to_ln': 128, 'input_cshape': '64x64', 'max_sim_iters': 400 }) if __name__ == '__main__': sim = LatNetController(simulation=TempoGanSimulation) sim.run()