Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCS: Refactor #878

Merged
merged 15 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/878.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactor
Binary file modified doc/source/_static/logo/pymechanical-logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/source/_static/logo/pymechanical-logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@
"examples/index": [],
"contributing": [],
}

html_show_sourcelink = False

# -- Options for LaTeX output ------------------------------------------------
latex_elements = {}

Expand Down Expand Up @@ -311,6 +314,9 @@

linkcheck_anchors = False

# User agent
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.2420.81" # noqa: E501

# If we are on a release, we have to ignore the "release" URLs, since it is not
# available until the release is published.
switcher_version = get_version_match(version)
Expand Down
12 changes: 6 additions & 6 deletions doc/source/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@ Examples
Here are examples using Mechanical with the ``ansys-mechanical-core`` library through
an embedded instance or remote session.

.. grid:: 2
.. grid:: 1 2 2 2

.. grid-item-card:: Embedding Examples
:link: https://embedding.examples.mechanical.docs.pyansys.com/index.html
:padding: 2 2 2 2
:link: https://embedding.examples.mechanical.docs.pyansys.com/examples/index.html
:text-align: center
:margin: 2 2 0 0

Uses PyMechanical to embed an instance of Mechanical directly within Python as a Python object.

.. grid-item-card:: Remote Session Examples
:link: https://examples.mechanical.docs.pyansys.com/index.html
:padding: 2 2 2 2
:link: https://examples.mechanical.docs.pyansys.com/examples/index.html
:text-align: center
klmcadams marked this conversation as resolved.
Show resolved Hide resolved
:margin: 2 2 0 0

Uses PyMechanical as a client to a remote Mechanical instance.

.. grid:: 1

.. grid-item-card:: Embedding Instance & Remote Session Example
:padding: 2 2 2 2
:link: gallery_examples/embedding_n_remote/embedding_remote.html
:text-align: center
:margin: 2 2 0 0

Demonstrates the same model setup in both an embedded instance and remote session,
as well as examples using a combination of embedded instances and remote sessions.
151 changes: 151 additions & 0 deletions doc/source/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
.. _faq:

Frequently asked questions
==========================

This section provides answers to frequently asked questions.

.. dropdown:: How do you report issues?

You can report issues with PyMechanical, such as bugs, feature requests,
and documentation errors, on the PyMechanical repository's `Issues
<https://github.com/ansys/PyMechanical/issues>`_ page.

If you want to ask more open-ended questions or are seeking advice
from experts in the community, you can post on this repository's
`Discussions <https://github.com/ansys/pymechanical/discussions>`_ page.

.. dropdown:: How is PyMechanical positioned with respect to other related Ansys tools?

When you want to automate or extend Ansys Mechanical, you should
consider these tools:

* ACT in Mechanical
* Scripting in Mechanical
* PyMechanical

Although all of these tools work best in interactive mode, there is increasing support
for batch mode. You can use the first two tools from either Ansys Workbench or from
standalone Mechanical.

ACT in Mechanical
^^^^^^^^^^^^^^^^^

In Mechanical, ACT is a customization framework. When specific features are missing,
you can add them using ACT. Of course, some of those missing features might be
automations or scripts of existing features. But, in many cases, they can be new
capabilities, such as extensions to Mechanical's data model, the ability to connect
to callbacks, and even integrations of external solvers.

Scripting in Mechanical
^^^^^^^^^^^^^^^^^^^^^^^

The Python scripting capability in Mechanical was born out of the same development
that brought ACT to Mechanical. This tool provides the same APIs as those used for
PyMechanical but can only be run by Mechanical. While they use IronPython 2.7 by
default, recent Mechanical versions provide a feature flag for scripting in CPython 3.x.
Mechanical's intuitive user interface for scripting, the **Mechanical Scripting View**,
provides script recording, autocomplete, and a snippet library. However, it is possible
to use this tool in batch mode without the Mechanical user interface.

PyMechanical
^^^^^^^^^^^^

PyMechanical allows you to write Python scripts outside of Mechanical, with tight
integration with other open source modules and Ansys products. With this tool, you
bring your own Python environment, which may contain other modules and tools. There is
no dependency on opening the Mechanical user interface.

.. dropdown:: What is the relationship with Ansys Workbench?

Ansys Workbench is a no-code environment to set up analysis systems that can be linked
together. It is part of the Ansys family of software tools for process automation and design
exploration. This family includes Ansys OptiSLang, which may be a more natural fit
for integration with PyMechanical. The most popular app within the Workbench environment is
Mechanical, and for many years, Workbench was the only environment you could run Mechanical from.

Because Workbench is a no-code environment, a lot of the complexity around managing data
transfer between Ansys apps and running parametric studies is hidden. PyMechanical and
PyAnsys libraries more broadly give you much more control over your process automation and design
exploration. However, eliminating Workbench means that you miss out on what it handled under
the hood.

.. dropdown:: How do you restart a script?

If you have trouble terminating a simulation, you do not have to close Python, reopen it, and
clear all previous data such as the mesh using this code:
klmcadams marked this conversation as resolved.
Show resolved Hide resolved

.. code:: python

import sys

sys.modules[__name__].__dict__.clear()

Simply exiting Python should clear the solution within Python. This is because
stopping the original process means that nothing should be in present in
a new process.

The way that you clear all data from Mechanical in PyMechanical depends on if
Mechanical is a remote session or embedded.

- If Mechanical is a remote session, use either the
`Mechanical.clear() <../api/ansys/mechanical/core/mechanical/Mechanical.html#Mechanical.clear>`_
method or exit and restart Mechanical.
- If Mechanical is embedded, use the
`app.new() <../api/ansys/mechanical/core/embedding/app/App.html#App.new>`_
method.

.. dropdown:: How to check if license is active with PyMechanical ?
dipinknair marked this conversation as resolved.
Show resolved Hide resolved

Mechanical product related information can be printed with remote and embedding mode as given below
dipinknair marked this conversation as resolved.
Show resolved Hide resolved

.. tab-set::

.. tab-item:: Remote

.. code-block:: python

import ansys.mechanical.core as pymechanical

mechanical = pymechanical.launch_mechanical()
print(mechanical)

.. tab-item:: Embedding

.. code-block:: python

import ansys.mechanical.core as pymechanical

app = pymechanical.App()
print(app)

The output from above shows what license is being used inside [] right to Ansys Mechanical . If the PyMechanical
is unable to grab any license then it will be left blank
dipinknair marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: shell

Ansys Mechanical [Ansys Mechanical Enterprise]
Product Version:242
Software build date: 06/03/2024 09:35:09



.. dropdown:: How to fix mechanical-env error in Linux ?
dipinknair marked this conversation as resolved.
Show resolved Hide resolved

To use embedded instance in Linux, mechanical-env should be called before starting python shell or running python script.
Example usage is given below
dipinknair marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: shell

$ mechanical-env python
>>> import ansys.mechanical.core as mech
>>> app=mech.App(version=42)

or

.. code-block:: shell

$ mechanical-env python pymechanical-test.py



100 changes: 0 additions & 100 deletions doc/source/getting_started/faq.rst

This file was deleted.

Loading
Loading