Page MenuHomec4science

plots_multiple.py
No OneTemporary

File Metadata

Created
Sun, May 5, 19:01

plots_multiple.py

import numpy as np
import matplotlib.pyplot as plt
from ddm_wave_prop import *
dataset_path = r'C:/Travail/EPFL/Cours/M2/Projet CSE/LAMMPS/Dataset/'
gif_path = r'C:/Travail/EPFL/Cours/M2/Projet CSE/CODE/DDM/img/'
create_gif = True
plot_energies = True
plot_displacements = True
# PARAMETERS
L = 0.05 # element length (m)
A = L**2 # element cross-section area (m2)
E = 2e6 # young modulus (only useful for strain energy)
rho = 2000 # = 2500*0.8 kg/m3
periods = [0.07, 0.11,0.2] # sinus periods (s)
ampl = 0.01 # sinus amplitude (m)
# DATASET
dataset = load_dataset(dataset_path)
all_displacements = {}
for t0 in periods:
dt = t0/100. # timestep to get 100 points per periods
Ttime = 3*t0 # plot 3 periods
displacement = lambda t: ampl*np.sin(2*np.pi*t/t0)
coords, all_displacements_t0, KE, SE, TE = wave_propagation_pressure(dataset, E, A, L, displacement, Ttime, dt, rho)
all_displacements[t0] = all_displacements_t0
save_gif_T(gif_path, coords, all_displacements)

Event Timeline