Hello Alex, PrintFsiInfoToFile() <https://github.com/projectchrono/chrono/blob/main/src/chrono_fsi/ChSystemFsi.cpp#L993> can output the position, pose and forces and torques applied to the FSI body to a file. See demo_FSI_CylinderDrop.cpp <https://github.com/projectchrono/chrono/blob/aad5e16bf2c585fca6d00655879bba3c550a9c9e/src/demos/fsi/demo_FSI_CylinderDrop.cpp#L332> as an example where the outputs are written to the DEMO_OUTPUT/FSI_Cylinder_Drop/fsi/FSI_body0.csv file.
Though FSI does not have an API that returns the body force and torque directly to the user yet, you can implement your own in ChSystemFSI.cpp <https://github.com/projectchrono/chrono/blob/main/src/chrono_fsi/ChSystemFsi.cpp> . You can take a look at the implementation in Add_Rigid_ForceTorques_To_ChSystem() <https://github.com/projectchrono/chrono/blob/main/src/chrono_fsi/physics/ChFsiInterface.cpp#L36>, or Add_Flex_Forces_To_ChSystem() <https://github.com/projectchrono/chrono/blob/main/src/chrono_fsi/physics/ChFsiInterface.cpp#L73>, to see how the force/torque are extracted. For example, if you want the force from SPH particles applied to the i-th rigid FSI body, your implementation can be, *ChVector<float> ChSystemFsi::GetFsiBodyForce(int i) const { thrust::host_vector<Real3> forcesH = m_sysFSI->fsiGeneralData->rigid_FSI_ForcesD; return utils::ToChVector(forcesH[i]);}* Note that the force is expressed in global coordinate. Thank you, Luning On Wednesday, March 20, 2024 at 10:40:02 PM UTC-5 Alex Lan wrote: > Hi, I want to get the force that SPH particles applied to a FSI body or > mesh. How can I get it? > Regards. > -- You received this message because you are subscribed to the Google Groups "ProjectChrono" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/8f29283a-1d2d-40ca-864a-dc6feb34a7bdn%40googlegroups.com.
