3.10 Exercise 3: Oscillations of a Buoyant Object
37
dw obj
dt
= −g
(ρ obj − ρ amb )
ρ obj
(3.18)
The buoyancy force on the right-hand side of the latter equation varies in magnitude and sign in dependence of the object’s location. On the other hand, the location
of the object, z obj , changes owing to its vertical speed w obj according to:
dz obj
dt
= w obj
(3.19)
The latter two equations are coupled with each other, for the object’s location
determines the density found in the ambient flui and, hence, the magnitude of the
buoyancy force.
3.10.4 Code Structure
The code has three parts:
1. a predictor for vertical speed w obj
2. a predictor for the new location z obj
3. a calculator of the ambient oceanic density with respect to the object’s location.
3.10.5 Finite-Difference Equations
In finite-di ference form, Eq. (3.18) can be written as:
w
n+1
obj = w
n
obj − Δt g (ρ obj − ρ amb )/ρ obj
(3.20)
where n is the time level and Δt is the time step chosen. Equation (3.19) can be
written as:
z
n+1
obj = z
n
obj + Δt · w
n+1
obj
(3.21)
The use of time level (n + 1) for vertical speed w obj in the latter equation just
means that input into this equation comes from the predicted value of w obj from the
previous equation. In other words, step (3.20) has to come before step (3.21). The
time step is set to Δt = 1 s.
3.10.6 Initial and Boundary Conditions
The initial location of the object set to z
0
obj = −80 m. The initial vertical speed w
0
obj
is set to zero. Boundary conditions need to be specifie in addition to this to avoid
37
dw obj
dt
= −g
(ρ obj − ρ amb )
ρ obj
(3.18)
The buoyancy force on the right-hand side of the latter equation varies in magnitude and sign in dependence of the object’s location. On the other hand, the location
of the object, z obj , changes owing to its vertical speed w obj according to:
dz obj
dt
= w obj
(3.19)
The latter two equations are coupled with each other, for the object’s location
determines the density found in the ambient flui and, hence, the magnitude of the
buoyancy force.
3.10.4 Code Structure
The code has three parts:
1. a predictor for vertical speed w obj
2. a predictor for the new location z obj
3. a calculator of the ambient oceanic density with respect to the object’s location.
3.10.5 Finite-Difference Equations
In finite-di ference form, Eq. (3.18) can be written as:
w
n+1
obj = w
n
obj − Δt g (ρ obj − ρ amb )/ρ obj
(3.20)
where n is the time level and Δt is the time step chosen. Equation (3.19) can be
written as:
z
n+1
obj = z
n
obj + Δt · w
n+1
obj
(3.21)
The use of time level (n + 1) for vertical speed w obj in the latter equation just
means that input into this equation comes from the predicted value of w obj from the
previous equation. In other words, step (3.20) has to come before step (3.21). The
time step is set to Δt = 1 s.
3.10.6 Initial and Boundary Conditions
The initial location of the object set to z
0
obj = −80 m. The initial vertical speed w
0
obj
is set to zero. Boundary conditions need to be specifie in addition to this to avoid
