What does "delta_vel_pos_AI" in Pipe (G) means?

5 visualizaciones (últimos 30 días)
PY
PY el 24 de Jul. de 2021
Comentada: PY el 10 de Ag. de 2021
In the source code of simscape component Pipe (G), line 237-241
% Change in flow velocity
delta_vel_AI = (1/rho_I - 1/rho_AI)*mdot_A/area;
delta_vel_BI = (1/rho_I - 1/rho_BI)*mdot_B/area;
delta_vel_pos_AI = sqrt(delta_vel_AI^2 + (0.001*a_AI)^2);
delta_vel_pos_BI = sqrt(delta_vel_BI^2 + (0.001*a_BI)^2);
and line 326-328
% Momentum balance
p_A - p_I == delta_vel_pos_AI*mdot_A/area + pressure_loss_AI;
p_B - p_I == delta_vel_pos_BI*mdot_B/area + pressure_loss_BI;
What do delta_vel_pos_AI and delta_vel_pos_BI mean?
According to the documentation Rigid conduit for gas flow - MATLAB - MathWorks Deutschland, the momentum balance does not consider anything related to the speed of sound for unchoked flow. What is the meaning of the term "(0.001*a_AI)^2"? I tried to find it in the two references of the documentaion but could not find anything related.
Should it not simply be
p_A - p_I == delta_vel_AI*mdot_A/area + pressure_loss_AI;
so that it matches the momentum balance equation stated in the documentation?
Thank you in advance.
  2 comentarios
Yifeng Tang
Yifeng Tang el 27 de Jul. de 2021
It looks to me to be a term designed to avoid excessive zero-crossing detection behavior and/or unnecessary reset due to discontinuity, both can be triggered by the near-zero behavior of the sqrt function, for better numerical robustness. Let me check with the development team and get back to you later.
More on this topic:
" Prior to simulation, you can use the Statistics Viewer to identify the potential zero-crossing signals in the model. These signals are typically generated from operators and functions that contain discontinuities, such as comparison operators, abs, sqrt functions, and so on. During simulation it is possible for none of these signals to produce a zero-crossing event or for one or more of these signals to have multiple zero-crossing events. For more information, see View Model Statistics. "
PY
PY el 27 de Jul. de 2021
Thank you for your reply.
I tried to edit the code and use it in a user-defined block, and with the same input parameters, the resulted pressure drop is very different if I delete this term, so I guess it should have a physical meaning instead of just for better numerical robustness.
In the reference there are equations related to the speed of sound in the chapter about compressible flow, however I could not find this exact equation or equation which can be transformed into this term.
I am looking forward to your further explaination. Thank you.

Iniciar sesión para comentar.

Respuesta aceptada

Yifeng Tang
Yifeng Tang el 30 de Jul. de 2021
Hi PY,
The term is using a trick to avoid using the abs() function, which may otherwise trigger frequent zero-crossing when mdot is small. Using the sqrt() formulation and having a value that's always > 0, no zero-crossing would be triggered when solving the equations.
Later the momentum balance equation needs to compute abs(delta_vel_AI)*mdot_A/area. Here delta_vel_pos_AI is approximately abs(delta_vel_AI) when delta_vel_AI is not very small. If delta_vel_AI is small or close to 0.001*speed_of_sound, the mdot_A term would also be small, and the impact on the total momentum balance should also be neglible.
I'm curious what you found after modifying the block. Would you be able to share the .ssc file and a test model?
  3 comentarios
Yifeng Tang
Yifeng Tang el 9 de Ag. de 2021
Hi PY,
I'm able to reproduce this on my end. I believe in this case, the (0.001*a_AI)^2 terms on lines 240, added to avoid triggering zero-crossing in otherwise abs(), was large enough compared to delta_vel_AI, and it's actually affect the results. Changing that 0.001 to say 1e-6, and I got the same answer of -31.38 Pa.
I see this error can be significant for your application. I'll discuss with the development if changing that coefficient could lead to issues like tolerance (I don't think so but better check).
Also, the code your modified, shoud have an abs() on line 327 & 328.
p_A - p_I == abs(delta_vel_AI)*mdot_A/area + pressure_loss_AI;
p_B - p_I == abs(delta_vel_BI)*mdot_B/area + pressure_loss_BI;
Otherwise when the flow reserves, the first term will have the wrong sign.
PY
PY el 10 de Ag. de 2021
Thank you for the advice.
If there are any results after the discussion with the development team, I should be grateful, if you could provide me with the updated informations.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Gas Models en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by