Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ansys-systemcoupling-core
Advanced tools
|pyansys| |GH-CI| |codecov| |MIT| |black|
.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC :target: https://docs.pyansys.com/
.. |GH-CI| image:: https://github.com/ansys/pysystem-coupling/actions/workflows/ci.yml/badge.svg :target: https://github.com/ansys/pysystem-coupling/actions/workflows/ci.yml
.. |codecov| image:: https://codecov.io/gh/pysystem-coupling/branch/main/graph/badge.svg :target: https://codecov.io/gh/ansys/pysystem-coupling
.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg :target: https://opensource.org/licenses/MIT
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat :target: https://github.com/psf/black :alt: black
PySystemCoupling provides Pythonic access to Ansys System Coupling. Although this Ansys product exposes its own Python-based scripting and command line interface, it is embedded and based on a specific version of Python. In contrast, PySystemCoupling enables seamless use of System Coupling within the Python ecosystem, providing additional capabilities, including:
Install PySystemCoupling with this command:
.. code::
pip install ansys-systemcoupling-core
Alternatively, clone and install PySystemCoupling in development mode with this code:
.. code::
git clone https://github.com/ansys/pysystem-coupling.git cd pysystem-coupling python -m pip install --upgrade pip pip install -e . pip install .[classesgen] python scripts\generate_datamodel.py
For more information, see the Documentation <https://systemcoupling.docs.pyansys.com>
_ page.
Use the PySystemCoupling Issues <https://github.com/ansys/pysystem-coupling/issues>
_ page to
post bug reports, questions and feature requests.
It is assumed that an Ansys installation is available and that this installation includes System Coupling and the participant products needed for the coupled analysis.
The System Coupling installation is found by examining the following environment variables in this order:
SYSC_ROOT
AWP_ROOT
AWP_ROOT242
If a variable is set but does not refer to a valid installation, PySystemCoupling fails at that point, rather than attempting to use the next variable.
In a standard user installation, the expectation is that only AWP_ROOT242
is set.
(It is also possible to provide a different version number as an argument to the launch()
function. This will affect which AWP_ROOT<version>
environment variable is examined.)
The System Coupling API is exposed to PySystemCoupling in two forms:
Both forms are strongly related to each other. A key difference in the Pythonic API is that naming is adjusted, in a generally predictable manner, to follow Python conventions. If you are already familiar with System Coupling, adjusting to this form, which is the recommended API, should be easy. However, if you are transitioning existing scripts, the native System Coupling API is made available as a convenience.
.. note::
While most commands should work as expected via the native System Coupling API, no guarantees can be given because of the nature of how it is exposed.
This example shows how to set up and solve an oscillating plate example in the Pythonic API. It uses Ansys Fluent as the CFD solver.
.. code:: python
import ansys.systemcoupling.core as pysystemcoupling
syc = pysystemcoupling.launch() setup = syc.setup setup.add_participant(input_file="mapdl.scp") setup.add_participant(input_file="fluent.scp")
interface_name = "interface-1" interface = setup.coupling_interface.create(interface_name) interface.side["One"].coupling_participant = "MAPDL-1" interface.side["One"].region_list = ["FSIN_1"] interface.side["Two"].coupling_participant = "FLUENT-2" interface.side["Two"].region_list = ["wall_deforming"]
force_transfer_name = setup.add_data_transfer( interface=interface_name, target_side="One", side_one_variable="FORC", side_two_variable="force", )
disp_transfer_name = setup.add_data_transfer( interface=interface_name, target_side="Two", side_one_variable="INCD", side_two_variable="displacement", )
setup.solution_control.time_step_size = "0.1 [s]" setup.solution_control.end_time = "1.0 [s]"
setup.output_control.option = "StepInterval" setup.output_control.output_frequency = 2
syc.start_output()
solution = syc.solution solution.solve()
The Pythonic API partitions commands via three high-level root attributes of the
Session
class: setup
, solution
, and case
. The preceding example
uses both the setup
and solution
attributes.
setup
attribute is the largest part of the API. It is where you find all
commands related to populating the settings that define a coupled analysis. This
attribute also provides direct access to the hierarchical data model.solution
attribute is home to commands related to solving an analysis and
examining the solution.case
attribute, which is not used in the preceding example, provides all
commands related to case file management and persistence.While the preceding example uses the pysystemcoupling.launch()
method to start the
System Coupling server, alternatively, the server can be started in advance by calling
command line arguments -m cosimgui --grpcport=<host:port>
and
pysystemcoupling.connect(host, port)
.
This next example shows how to set up the same analysis using the native System Coupling API. While the code here is less complete than the code shown previously, it should sufficiently illustrate the differences and connections between the two API forms.
.. code:: python
import ansys.systemcoupling.core as pysystemcoupling
syc = pysystemcoupling.launch() native_api = syc._native_api
native_api.AddParticipant(InputFile="mapdl.scp") native_api.AddParticipant(InputFile="fluent.scp")
interface = native_api.CouplingInterface["interface-1"] interface.Side["One"].CouplingParticipant = "MAPDL-1" ...
native_api.SolutionControl.TimeStepSize = "0.1 [s]" ... syc.start_output() native_api.Solve()
PySystemCoupling is licensed under the MIT license.
The ansys-systemcoupling-core
package makes no commercial claim over Ansys
whatsoever. It extends the functionality of Ansys System Coupling by
adding a Python interface to the System Coupling service without changing the
core behavior or license of the original software. Interactively controlling
System Coupling via PySystemCoupling requires a local copy of System Coupling
and licenses for all Ansys products involved in your coupled analysis.
To get a copy of Ansys, visit Ansys <https://www.ansys.com/>
_.
FAQs
A Python wrapper for Ansys System Coupling.
We found that ansys-systemcoupling-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.