The Ball Valve Partner Code Simulation
In this tutorial, you are provided with a sample partner code that solves the equation of motion for the ball valve. Compile the code and launch the ball valve solid simulation.
A spring connected to the ball valve allows the valve motion in response to the fluid forces. The ball valve is constrained to move along its axial direction, that in this tutorial corresponds to the z direction. The partner code calculates the position of the valve treating the model as a 1-DoF spring-mass-damping system, with equation of motion:
where is the ball valve mass, is the damping coefficient, is the spring stiffness, and is the z component of the traction field imported from the Simcenter STAR-CCM+ fluid simulation, integrated over surface. In this tutorial damping effects are neglected, so . The equation of motion, Eqn. (5316), is solved using the Newmark-beta numerical integration method.
The code that is provided in this tutorial consists of several .cpp and .h files. The main file, SpindleValve.cpp, outlines the recommended workflow when using the Co-Simulation API, from loading the Co-Simulation API library to setting up the co-simulation loop. You can modify the ball valve simulation time-step and maximum physical time values in this file. You can modify the spring-mass-damping system parameters in the file, SpringMassSolver.cpp.
Compiling the code generates an executable file, that you use to launch the ball valve solid simulation.