使用 powershell 运行 Ansys

问题描述 投票:0回答:1

我正在尝试使用 powershell 运行 Ansys。 我对 powershell 环境完全陌生。 我从 Ansys 网站和不同的在线论坛获得的唯一帮助是使用以下命令行提示符 (cmd) 运行 ansys

%ans_path% -b -np %num_proc% -j %job% -run %run% -i therm.inp -o trun.out

哪里

%ans_path%
%num_proc%
等是早期定义的变量。

参考:https://deepthoughtdocs.flinders.edu.au/en/latest/software/ansys.html

如何在 Powershell 中运行相同的代码? 或者我是否必须从 powershell 调用 CMD 才能运行此代码?

非常感谢任何方向的帮助!

powershell ansys
1个回答
0
投票

不太可能需要调用

cmd.exe
。 PowerShell 命令可能是:

& "C:\Program Files\ans\ansys212.exe" -b -np 4 -j 'the_job' -run 'the_run' -i therm.inp -o trun.out

这假设

-np
参数是数字,并且
-j
-run
是分别命名作业和运行的字符串。

如果您想“就像 cmd 一样”,那么您可以:

$AnsPath = 'C:\Program Files\ans\ansys212.exe'
$NumProcessors = 4
$JobName = 'the_job'
$RunName = 'the_run'
& $AnsPath -b -np $NumProcessors -j $JobName -run $RunName -i therm.inp -o trun.out
© www.soinside.com 2019 - 2024. All rights reserved.