Inquiry for Applying the Pressure in PyMechanical
My research requires applying the pressure field to the surface of the seal WITHIN THE MEMORY. I have read one of the examples in PyMechanical (URL: Inverse-Solving analysis of a rotor fan blade with disk — PyMechanical Embedding Examples (pyansys.com)), it reads the pressure field from an external CSV file and applies to the blade surface. However, this process will cost lots of time in both reading and writing, which I am trying to avoid. In our project, the pressure field is a function of coordinates (x, y, z) and is stored in the memory during the calculation. Is there any way I can apply the pressure field to the object surface without generating external files?
I would appreciate it if anyone could shed some light on my question.
Best Answer
-
Hello, some thoughts that I hope helps you to move forward with this:
-The good of using "External Data" with a file is that the "interpolation" is handled automatically by the External Data tool, which means that you can have different locations with input data and mesh nodes. The drawback, as you mentioned, is that you need to write and import an additional file.
-One way to investigate to do it "on the fly" is by trying the Tables option in Mechanical.
Code Example
import Ansys.Mechanical.DataModel.MechanicalEnums.Table as Table tableGroup = ExtAPI.DataModel.Project.Model.TableGroup myTable = tableGroup.AddTable() myTable.CreateAndAddColumn(Table.VariableType.XCoordinate,Table.VariableClassification.Independent,[10,10],"mm")
-Other way to investigate is to "try doing the interpolation" on your own. Since you have the initial positions X,Y,Z and pressure value, and you can obtain the node location of you mesh, you could investigate interpolating with some algorithms to mesh location, and the using SF command in a Command Snippet.
https://ansyshelp.ansys.com/public/account/secured?returnurl=/Views/Secured/corp/v242/en/ans_cmd/Hlp_C_SF.html?q=sfCode Example for mesh
mesh=ExtAPI.DataModel.Project.Model.Analyses[0].MeshData mesh.Nodes
Best Regards
Abel1
Answers
-
@Abel Ramos said:
Hello, some thoughts that I hope helps you to move forward with this:-The good of using "External Data" with a file is that the "interpolation" is handled automatically by the External Data tool, which means that you can have different locations with input data and mesh nodes. The drawback, as you mentioned, is that you need to write and import an additional file.
-One way to investigate to do it "on the fly" is by trying the Tables option in Mechanical.
Code Example
import Ansys.Mechanical.DataModel.MechanicalEnums.Table as Table tableGroup = ExtAPI.DataModel.Project.Model.TableGroup myTable = tableGroup.AddTable() myTable.CreateAndAddColumn(Table.VariableType.XCoordinate,Table.VariableClassification.Independent,[10,10],"mm")
-Other way to investigate is to "try doing the interpolation" on your own. Since you have the initial positions X,Y,Z and pressure value, and you can obtain the node location of you mesh, you could investigate interpolating with some algorithms to mesh location, and the using SF command in a Command Snippet.
https://ansyshelp.ansys.com/public/account/secured?returnurl=/Views/Secured/corp/v242/en/ans_cmd/Hlp_C_SF.html?q=sfCode Example for mesh
mesh=ExtAPI.DataModel.Project.Model.Analyses[0].MeshData mesh.Nodes
Best Regards
AbelThanks for your input, Abel. I am trying to combine both right now. The first step is to read the coordinates of nodes on the surface. Then I interpolate the pressure at these nodes via my local shape functions. The final step is to apply the surface pressure through the Table. Hopefully, this will work.
0