Skip to content

Commit

Permalink
working sim with two disks
Browse files Browse the repository at this point in the history
  • Loading branch information
SamRaymond committed Sep 18, 2024
1 parent 5e53c1c commit d76588a
Show file tree
Hide file tree
Showing 5 changed files with 903 additions and 215 deletions.
10 changes: 5 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@
}

# Define disk parameters
disk1_radius = 2*cell_size
disk1_radius = 6*cell_size
disk1_center = (0.25, 0.25)
disk1_object_id = 1

disk2_radius = 2*cell_size
disk2_radius = 6*cell_size
# Calculate the center of the second disk
# It should be 2 cells from the edge of the first disk
disk2_x = disk1_center[0] + disk1_radius + 4*cell_size + disk2_radius
disk2_x = disk1_center[0] + disk1_radius + 3*cell_size + disk2_radius
disk2_center = (disk2_x, disk1_center[1])
disk2_object_id = 2

Expand Down Expand Up @@ -96,14 +96,14 @@
# else:
# print("Invalid input. Please press Enter to continue or '0' to exit.")

dt = particles.compute_dt(cfl_factor=0.1)
dt = particles.compute_dt(cfl_factor=0.2)

print(f"dt: {dt}")
# Create MPM solver

solver = MPMSolver(particles, grid, dt)

num_steps = 5000
num_steps = 10000

# Create an output directory if it doesn't exist
output_dir = "simulation_output"
Expand Down
2 changes: 1 addition & 1 deletion results_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def update(frame):
# Calculate and store energies
youngs_modulus = float(csv_files[frame].split('_')[-1].split('.')[0]) # Extract Young's modulus from filename
ke = calculate_kinetic_energy(velocities, masses)
ee = 1e-4*calculate_elastic_energy(stress, volumes, youngs_modulus)
ee = calculate_elastic_energy(stress, volumes, youngs_modulus)
te = ke + ee
kinetic_energy.append(ke)
elastic_energy.append(ee)
Expand Down
Loading

0 comments on commit d76588a

Please sign in to comment.