Xiangyu-Hu / SPHinXsys

SPHinXsys provides C++ APIs for engineering simulation and optimization. It aims at complex systems driven by fluid, structure, multi-body dynamics and beyond. The multi-physics library is based on a unique and unified computational framework by which strong coupling has been achieved for all involved physics.
https://www.sphinxsys.org/
Apache License 2.0
259 stars 199 forks source link

FreeStreamVelocityCorrection not working properly in 3D #193

Closed anastazja-bro closed 1 year ago

anastazja-bro commented 1 year ago

FreeStreamVelocityCorrection in a 3D case is causing unexpected changes in the density distribution and incorrect velocity profile near the outlet #194 image image

YuVirtonomy commented 1 year ago

The first picture is the result with FreeStreamVelocityCorrection and the second picture is the result without FreeStreamVelocityCorrection. With FreeStreamVelocityCorrection you can see at the end of x and y axis directions, the stream no longer points in the +X direction.

WithFreeStreamVelocityCorrection

WithoutFreeStreamVelocityCorrection

ShuoguoZhangTUM commented 1 year ago

sorry, I can't analyze the causes only according to your pictures, if you can send me your C++ case file, I am pleased to help you. my email address is shuoguo.zhang@tum.de

YuVirtonomy commented 1 year ago

Hii shuoguo,

This issue is related to the pull request #194 , you can click #194 to find the test case. Than you.

ShuoguoZhangTUM commented 1 year ago

I have read your code, I think the definition of the freestream velocity profile is wrong. Here is the code you write. target_velocity[0] = u_ave (DH/2 - position[1]) (DH/2 + position[1]) / DH / DH; In 2D case, the velocity profile is defined by the position[0] and position[1]. but in 3D, there should also be a position[2] together to define the velocity profile. In 3d channel flow, both the velocity profile in xy and xz planes are parabolic. however, your code only defines the parabolic profile in xy plane.

anastazja-bro commented 1 year ago

Hi Shuoguo, The purpose of this case was to extend the 2D case, so the parabolic velocity profile was meant to be maintained only in xy plane, while in xz plane it's just part of the infinite flow, so it should be constant in z direction. The reason, why I needed the velocity correction is that the two z-normal walls were supposed to be removed and for now the only other way to simulate this case was to manually set velocity[2] of free surface particles to 0. Otherwise, there is no boundary condition on z-normal surfaces and the flow obviously goes to the sides.

Xiangyu-Hu commented 1 year ago

Hi, @anastazja-bro does Shuoguo's solution work?

Xiangyu-Hu commented 1 year ago

Please check the communications respect to the pull request for the solution of the issue.