I am writing an ACT extension to encapsulate a custom result and need to take the derivative of that
-
-
October 4, 2017 at 12:20 pm
Vishal Ganore
Ansys EmployeeThere are two main options here: Create the derivative yourself in Python, or call out to APDL to invoke the DERIV command. If creating the derivative yourself, it will require some numerical programming as (unfortunately) ACT's Python does not have access to SciPy. If calling APDL, note that ansys.RunANSYS() might not won't work in an Evaluate or Generate callback due to a threading issue. It probably will, but if not, here is how to do it without "import ansys" capabilities: --------------- import Ansys.Utilities from Ansys.Utilities import ApplicationConfiguration import System from System.Diagnostics import Process from System.Diagnostics import ProcessStartInfo from System.Diagnostics import ProcessWindowStyle # Create a tmp bat file in this path bat_file = System.IO.Path.Combine(apdlDir,'tmp.bat'); info = System.IO.StreamWriter(bat_file) a = ApplicationConfiguration.DefaultConfiguration.AwpRootEnvironmentVariableValue b = System.IO.Path.Combine(a,'ansys') c = System.IO.Path.Combine(b,'bin') d = System.IO.Path.Combine(c,ApplicationConfiguration.DefaultConfiguration.AnsysPlatform) e = System.IO.Path.Combine(d,'ansys162.exe') commandLine = '"'+e+'" -dir "'+apdlDir+'" -j "file" -b -i "'+apdlInput+'" -o "'+apdlOutput+'"' info.WriteLine(commandLine) info.Close() # Run the bat file now startInfo = ProcessStartInfo(bat_file, None) startInfo.WindowStyle = ProcessWindowStyle.Minimized p = Process.Start(startInfo) p.WaitForExit() # Delete the tmp bat file System.IO.File.Delete(bat_file) --------------- In this code, we create a tmp file with the command we want, and execute it with ANSYS. A nice way to get any APDL functionality in your ACT code.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- How to deal with the error message about “You have specified result time (or frequency) = xxxx for a
- What is cause of error: display time for result item greater than the step end time?
- Any suggestions on speeding up convergence behavior with surface-to-surface radiation?
- If SCDM issues the message “Cannot open the document. Reason: Failed to load body geometry.” and the
- In a harmonic analysis, is the damping produced by MP,DMPR; TB,SDAMP; and DMPSTR constant vs frequen
- Can I define springs with coincident nodes defining each end? Can I use one spring element to define
- Check
- While projecting surfaces/curves onto cylindrical surfaces, the final shape sometimes deteriorates.
- Can you limit the expansion of modes to only those modes with a high participation factors by using
- Why the section plane icon is grayed out in Mechanical windows ? How to make the section plane windo
-
5340
-
3341
-
2471
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.