Recursive model for body in fluid

  • Context: Graduate 
  • Thread starter Thread starter MrsTMouse
  • Start date Start date
  • Tags Tags
    Body Fluid Model
Click For Summary

Discussion Overview

The discussion revolves around developing a recursive model to calculate the position of a moving body in a fluid, focusing on both linear and angular motion. Participants explore numerical methods for solving ordinary differential equations (ODEs) and the implications of forces applied at different points on the body.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested, Mathematical reasoning

Main Points Raised

  • MrsTMouse describes their progress in simulating movement due to a central force and their challenges in modeling angular motion when forces are applied off-center.
  • Some participants suggest that computing torques is necessary for off-center forces and recommend learning numerical methods for ODEs, specifically mentioning Euler's method.
  • One participant requests an example calculation for torque and angular motion equations and inquires about accessible literature on numerical methods.
  • Another participant emphasizes the importance of determining the center of mass and moments of inertia before applying Newton's second law for angular motion.
  • There are discussions on using Runge-Kutta methods for solving ODEs, with one participant providing a detailed approach to implementing these methods for angular velocity and position calculations.
  • Concerns are raised about the accuracy of the proposed methods, particularly regarding the treatment of drag force and the need to rewrite second-order differential equations as coupled first-order equations.
  • A participant mentions that for spherical objects, drag should not produce torque, while another notes that rotating bodies may experience increased drag.
  • MrsTMouse indicates that their calculations are based on a ring, where surface friction is less significant than drag, and expresses intent to reformulate their ODEs as coupled first-order equations.

Areas of Agreement / Disagreement

Participants express varying opinions on the treatment of forces and torques, the application of numerical methods, and the specifics of modeling drag. No consensus is reached on the best approach to improve accuracy or the implications of different force applications.

Contextual Notes

Limitations include potential inaccuracies in the treatment of drag forces, the need for clarity on the sign of forces based on velocity direction, and the complexity of reformulating equations for numerical methods.

MrsTMouse
Messages
8
Reaction score
0
Good evening,

I've been trying to wrap my head around this problem for some time and I just can't seem to get it straight.

What I am trying to achieve:
I want to program a recursive model that calculates the position of a moving body in a fluid after a certain time.

What i have done already
I got as far as to simulate the movement due to a force applied at the center of the object.
In pseudo-code
for the speed at t = n
//calculate the drag force due to vn-1 Wikipedia reference
Fd = 0.5*ρ*vn-12*Cd*A //
// add any external force that may have been applied when n-1<=t<n and the gravitational force
Ftot= Fd+Fext+Fg
// calculate the acceleration of the object at n
an=Ftot/m
// assume the acceleration constant for dt so the velocity becomes
v = vn-1 + an*dt
// calculate the new coordinates of the object based on vn

This works fine as long as the time step dt is small enough (0<dt<0.00001)
The amount of calculations is too high. So i decided to approximate some more by limiting the rate of change of the drag force Fd.est = MAX(const,Fd)
This leads to a decent approximation with about a factor 100 less calculations per second (0<dt<0.001), which i think is sufficient. I observed a 10% disparity between the original and the approximation after 10^7 iterations.

What I'm struggling with
1) I'm stumped on how to model the angular motion when a force is applied a distance d from the center of the object
2) Is there a way to make the approximate the whole model more precisely but with the same dt = 0.001

If anyone has tips on how I can improve I would greatly appreciate it.

MrsTMouse
 
Physics news on Phys.org
For off-center forces, you will have to compute the produced torques and solve another equation for angular motion.

To compute things more efficiently, you will need to learn some numerical methods for ordinary differential equations. Your method, by the way, is known as Euler's method.
 
My dynamics are not what they ought to be. Could you provide an example calculation for the torque and the angular motion equations?
Is there a numerical method for ODE s that I can readily apply or if not, is there free literature I can read up in?

Thanks for the help, much appreciated.
 
First, you need to determine the center of mass and the moment(s) of inertia of your body. Then you need to determine the net torque of the forces (relative the center of mass). Then you will have an equation very similar to Newton's second law. Look up the details on Wikipedia, if unclear, ask for help here.

To solve an ODE, I would try by default one of the Runge-Kutta integrators. Wikipedia is your friend again.
 
So for the off-center forces:
// calculate all moments due to forces that apply on the body (drag, external, gravity = 0 due to symmetry)
Fd= 0.5*A*Cd*ρ*ωn-12
Mdrag = Fd*r where r = radius of the object(assuming the object is symmetrical)
Mext = Fext*x where x is the distance to to centre of mass
// calculate angular acceleration
α = Mtot/I
// calculate angular speed
ωnn-1+α*dt
// calculate new angle of the body
θnn-1n*dt

For the runge kutta methods. If I understood correctly I would want to calculate the (angular) velocity with it by doing above calculations 4 times with
k1 : euler
k2 : dt = dt/2 and vn-1 = vn-1 + k1*dt/2
k3 : dt = dt/2 and vn-1 = vn-1 + k2*dt/2
k4 : dt = dt and vn-1 = vn-1 + k3*dt

and then vn = vn-1 + dt/6(k1+2k2+2k3+k4)

and the new coordinates are then pn = pn-1 + vn*dt
 
MrsTMouse said:
For the runge kutta methods ...
and then vn = vn-1 + dt/6(k1+2k2+2k3+k4)

and the new coordinates are then pn = pn-1 + vn*dt

The first part of that looks OK, but the last part
pn = pn-1 + vn*dt

is throwing all improved accuracy away, because it is just the same as Euler's forward difference method!

You need to rewrite your second-order differential equation as two coupled first order equations and then solve both of them together using R-K. Any examples of solving equations of motion usiing R-K (on the web or in a textbook) should show you how to do it right. (Or search PF for other threads about RK, this sort of question comes up fairly often).

Also, it's not obvious from your equations that you will always have the correct sign for the drag force. Remember the force changes direction if the velocity is reversed, but ##v^2## does mot change sign when ##v## goes from positive to negative. Maybe you want to calcule ##v | v | ## instead (i.e. ##v## times the absolute value of ##v##.)
 
If your object is a sphere, then drag should not have any torque.

Secondly, a rotating body, even a sphere, produces greater drag, but I do not remember any details on that.
 
I made my calculations for a ring. So surface fri tion is much smaller than the drag.

I will try to rewrite my ode s as coupled first order equations as soon as I get some free time.
 

Similar threads

  • · Replies 35 ·
2
Replies
35
Views
5K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 48 ·
2
Replies
48
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K