-
-
March 8, 2024 at 2:56 amLijie YuanSubscriber
Hi!
I'm currently having problems implementing user Force using python. I first implemented the modeling, meshing, and computational parameter settings through workbench, and finally got two dat files in the dp0 folder for AQW and AQW-1 respectively.I did the user force calculation with reference to Aqwa_Reference_Manual after adding the SUFC option to the Timeresponse.dat file. It shows user force error number 1.
What is the problem please?from AqwaServerMgr import * def UF1(Analysis,Mode,Stage,Time,TimeStep,Pos,Vel): # Check that input file is the one expected without .DAT extension Error = 0 ExpectedFileName = "TimeResponse" ActualFileName = Analysis.InputFileName.split("\\")[-1] # We strip the path part of the filename for easy comparison if (ActualFileName!=ExpectedFileName): print("Error. Incorrect input file !") print("Expected : "+ ExpectedFileName) print("Actual : "+ActualFileName) Error = 1 # Will cause Aqwa to stop # If this passed, we create an empty container for AddMass and Force AddMass = BlankAddedMass(Analysis.NOfStruct) Force = BlankForce(Analysis.NOfStruct) # User defined code here # Here additional inertial force for structure s : F[s][dof] = AddMass[s][dof2][dof] * Acc[s][dof2] # (Einstein notation, and Python Row-Major order of array indices) for s in range(Analysis.NOfStruct): for dof in range(6): Force[s][dof] = -10000.0*Pos[s][dof] # Elastic Force for dof2 in range(6): AddMass[s][dof2][dof]=1e-3*(dof2*6+dof) # AddMass goes [0.000, 0.001, 0.002, ..., 0.036] # Now return the results return Force,AddMass,Error Server = AqwaUserForceServer() print('-----------------') print('Running user force function UF1') print('Simulating...') print('-----------------') Server.Run(UF1)
-
March 11, 2024 at 11:58 amMike PettitAnsys Employee
Hello,
You should not need to add the SUFC option manually - you can set this in Workbench from the time domain Analysis Settings, under Common Analysis Options:
You also need to start the Python server before the time domain analysis is launched. You can do this using a pre-solve Python script, or you can do it manually from the Windows command line. You can find an example of the Python server code in the Ansys installation, at C:\Program Files\ANSYS Inc\v232\aqwa\utils\ExternalForceCalculation\AqwaServerMgr.py (change the 'v232' as necessary for your installed version). You should not need to modify the code in AqwaServerMgr.py.
I hope this helps!
Mike
-
March 11, 2024 at 12:10 pmIngrid MAnsys Employee
Hello,Â
in addition to Mike's reply, in your installation, in your Ansys installation folder (under v
\aqwa\utils\ExternalForceCalculation) , you have the complete example of the script you are sharing. There is also a readme.txt and the bat file to start the server gracefully based on the python version installed in the application. I hope this helps,
Ingrid
-
March 12, 2024 at 12:17 pmIngrid MAnsys Employee
Hello again,Â
To be more specific, you don't run the AqwaServerMgr.py but the AqwaSocketUserForceExample.py file from the installation. The latter file calls the AqwaServerMgr when the server.run() command is fired.
If you run the whole simulation as command (like the readme in the installation folder), you just need to run:
on one side: \your path to python\python.exe AqwaSocketUserForceExample.py
on the other side: \you path to aqwa\aqwa.exe timeresponse.dat
I hope this helps.
-
- The topic ‘AQWA user force’ is closed to new replies.
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Cyclone (Stairmand) simulation using RSM
- error udf
- Script error Code: 800a000d
- Fluent fails with Intel MPI protocol on 2 nodes
- Diesel with Ammonia/Hydrogen blend combustion
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Encountering Error in Heterogeneous Surface Reaction
-
1191
-
513
-
488
-
225
-
209
© 2024 Copyright ANSYS, Inc. All rights reserved.