-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from mdienst/main
Documentation updates
- Loading branch information
Showing
3 changed files
with
60 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,63 @@ | ||
# # Pressure wave through bar | ||
# # Pressure wave in bar | ||
|
||
# First, import the Peridynamics.jl package: | ||
# In this tutorial, a cuboid bar is created. | ||
# A velocity pulse in the form of one period of a sine wave is applied to create | ||
# a pressure wave that propagates through the bar. | ||
# | ||
# First import the Peridynamics.jl package: | ||
using Peridynamics | ||
|
||
# To start off, we define the geometry of the simulated bar: | ||
# - Length $l_x = 0.2\,\text{m}$ | ||
# - Width $l_y = 0.05\,\text{m}$ | ||
# - Height $l_z = 0.05\,\text{m}$ | ||
# With the point spacing $Δx = \frac{l_x}{60}$, we can create a point cloud. | ||
length_x = 0.2 # [m] | ||
length_y = 0.05 # [m] | ||
length_z = 0.05 # [m] | ||
Δx = length_x / 60 # point spacing | ||
pc = PointCloud(length_x, length_y, length_z, Δx) | ||
|
||
# Now we characterize the material model as bond-based with the | ||
# - Horizon $ δ = 3.015 \cdot Δx$ | ||
# and the material parameters | ||
# - Density $ρ = 7850\,\mathrm{kg}\,\mathrm{m}^{-3}$ | ||
# - Young's modulus $E = 2 10 \, \mathrm{GPa}$ | ||
# - Griffith's parameter $G_c = 1000 \, \mathrm{N} \, \mathrm{m}^{-1}$ | ||
mat = BondBasedMaterial(; | ||
horizon=3.015Δx, # [m] | ||
rho=7850.0, # [kg/m^3] | ||
E=210e9, # [N/m^2] | ||
Gc=1000.0, # [N/m] | ||
) | ||
|
||
# Then we define the boundary conditions, which apply a velocity to the body. | ||
# Since the velocity is supposed to be applied on the left end of the bar, we first | ||
# define the set of points that represent the outermost layer in x-direction of the | ||
# points contained in the point cloud $pc$. | ||
point_set_bc = findall(pc.position[1,:] .< - length_x / 2 + 1.2 * Δx) | ||
# The applied velocity is represented by one sine oscillation with the period | ||
# $T = 0.00002\,\mathrm{s}$ and the amplitude | ||
# $v_\mathrm{max} = 0.5\,\mathrm{m}\,\mathrm{s}^{-1}$. | ||
# Afterwards, the velocity is $0$. (see Figure) | ||
# To get started, some parameters used to for this simulation are defined. | ||
# These are the length of the bar `lx`, the width and height `lyz` and the number of | ||
# points in the width `npyz`. | ||
|
||
lx = 0.2 | ||
lyz = 0.002 | ||
npyz = 4 | ||
|
||
# With these parameters the point spacing can be calculated: | ||
Δx = lyz / npyz | ||
# A cuboid body according to the ordinary state-based model with the specified dimensions | ||
# and point spacing is then created: | ||
pos, vol = uniform_box(lx, lyz, lyz, Δx) | ||
body = Body(OSBMaterial(), pos, vol) | ||
# Failure is prohibited throughout the body: | ||
failure_permit!(body, false) | ||
# Following material parameters are specified: | ||
|
||
# | material parameter | value | | ||
# |:--------|:-------------| | ||
# | Horizon $ δ $ | $3.015 \cdot Δx$ | | ||
# | Density $ρ$ | $ 7850\,\mathrm{kg}\,\mathrm{m}^{-3}$ | | ||
# | Young's modulus $E$ | $ 210 \, \mathrm{GPa}$ | | ||
# | Poisson's ratio $ν$ | $0.25$ | | ||
# | critical strain $ε_c$ | $0.01$ | | ||
material!(body, horizon=3.015Δx, rho=7850.0, E=210e9, nu=0.25, epsilon_c=0.01) | ||
# Point set `:left` including the first row of points in x-direction is created: | ||
point_set!(x -> x < -lx / 2 + 1.2Δx, body, :left) | ||
# The velocity boundary condition of the form | ||
# ```math | ||
# {v}_x (t) = | ||
# \begin{cases} | ||
# v_\mathrm{max} \cdot \sin(2\pi \cdot \frac{t}{T}) \qquad | ||
# & \forall \; 0 \leq t \leq T \\ | ||
# 0 &\text{else} | ||
# \end{cases} | ||
# ``` | ||
# is applied to point set `:left`. The parameters used for this excitation are period | ||
# length `T` and amplitude `vmax`. | ||
T, vmax = 1.0e-5, 2.0 | ||
velocity_bc!(t -> t < T ? vmax * sin(2π / T * t) : 0.0, body, :left, :x) | ||
# ![](../assets/impact_velocity.png) | ||
T = 0.00002 # [s] | ||
vmax = 0.5 # [m/s] | ||
vwave(t) = t < T ? vmax * sin(2π/T * t) : 0 | ||
# Now we submit these conditions. The number indicates the dimension in which the velocity | ||
# is applied, which in this case is the x-dimension signified by 1. | ||
boundary_conditions = [VelocityBC(vwave, point_set_bc, 1)] | ||
|
||
# Then we define the time discretization. We calculate 2000 time steps with the | ||
# Velocity Verlet algorithm: | ||
td = VelocityVerlet(2000) | ||
|
||
# We assign a name and specify the export settings such as the folder that the data | ||
# will be saved in. Here, 10 determines that every 10th time step | ||
# will be exported. | ||
simulation_name = "PressureWave" | ||
resfolder = joinpath(@__DIR__, "results", simulation_name) | ||
mkpath(resfolder) | ||
es = ExportSettings(resfolder, 10) | ||
|
||
# We define a job and pass along the previously set attributes. | ||
job = PDSingleBodyAnalysis(; | ||
name=simulation_name, | ||
pc=pc, | ||
mat=mat, | ||
bcs=boundary_conditions, | ||
td=td, | ||
es=es, | ||
) | ||
# The Velocity Verlet algorithm is used as time integration method and 2000 time steps | ||
# are calculated: | ||
vv = VelocityVerlet(steps=2000) | ||
# Then the storage path is defined: | ||
path = joinpath(@__DIR__, "results", "xwave", "xwave_osb") | ||
# The job is now defined and returned with the specified settings and parameters. | ||
job = Job(body, vv; path=path) | ||
|
||
# The last step is submitting the job to start the simulation. | ||
#md # ```julia | ||
#md # results = submit(job); | ||
#md # submit(job); | ||
#md # ``` | ||
|