


{"id":356022,"date":"2024-03-08T02:56:09","date_gmt":"2024-03-08T02:56:09","guid":{"rendered":"\/forum\/forums\/topic\/aqwa-user-force\/"},"modified":"2024-03-08T02:56:09","modified_gmt":"2024-03-08T02:56:09","slug":"aqwa-user-force","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/aqwa-user-force\/","title":{"rendered":"AQWA user force"},"content":{"rendered":"<p>Hi!<\/p>\n<p>I&#8217;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.<br \/>What is the problem please?<\/p>\n<pre>from AqwaServerMgr import *\ndef UF1(Analysis,Mode,Stage,Time,TimeStep,Pos,Vel):\n    # Check that input file is the one expected without .DAT extension\n\n    Error   = 0\n\n    ExpectedFileName = \"TimeResponse\"\n    ActualFileName = Analysis.InputFileName.split(\"\\\\\")[-1] # We strip the path part of the filename for easy comparison\n    if (ActualFileName!=ExpectedFileName):\n        print(\"Error. Incorrect input file !\")\n        print(\"Expected : \"+ ExpectedFileName)\n        print(\"Actual : \"+ActualFileName)\n        Error = 1    # Will cause Aqwa to stop\n\n    # If this passed, we create an empty container for AddMass and Force\n    AddMass = BlankAddedMass(Analysis.NOfStruct)\n    Force   = BlankForce(Analysis.NOfStruct)\n\n    # User defined code here\n    # Here additional inertial force for structure s : F[s][dof] = AddMass[s][dof2][dof] * Acc[s][dof2]\n    # (Einstein notation, and Python Row-Major order of array indices)\n    for s in range(Analysis.NOfStruct):\n        for dof in range(6):\n            Force[s][dof] = -10000.0*Pos[s][dof] # Elastic Force\n            for dof2 in range(6):\n                AddMass[s][dof2][dof]=1e-3*(dof2*6+dof) # AddMass goes [0.000, 0.001, 0.002, ..., 0.036]\n\n    # Now return the results\n\n    return Force,AddMass,Error\n\nServer = AqwaUserForceServer()\n\nprint('-----------------')\nprint('Running user force function UF1')\nprint('Simulating...')\nprint('-----------------')\nServer.Run(UF1)<\/pre>\n","protected":false},"template":"","class_list":["post-356022","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["340608","183765","20347"],"_bbp_author_ip":["168.143.243.24"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["808"],"_bbp_topic_status":["unanswered"],"_bbp_likes_count":["1"],"_bbp_notification_enabled":["481851"],"_bbp_topic_id":["356022"],"_bbp_forum_id":["27792"],"_bbp_engagement":["20347","183765","340608"],"_bbp_voice_count":["3"],"_bbp_reply_count":["3"],"_bbp_last_reply_id":["356612"],"_bbp_last_active_id":["356612"],"_bbp_last_active_time":["2024-03-12 12:17:26"]},"test":"yljgoodmail163-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/356022","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/356022\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=356022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}