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

Fix doc getting started #642

Merged
merged 6 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion docs/source/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@

.bd-content .sd-card .sd-card-body, .bd-content .sd-card .sd-card-footer {
background-color: transparent;
}
}

.sd-card-text {
font-family: var(--pst-font-family-base);
font-size: var(--pst-font-size-base);
}

.sd-sphinx-override .code {
background-color: var(--pst-color-surface);
}
4 changes: 0 additions & 4 deletions docs/source/_static/simple_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ extract results:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF Model
Expand Down Expand Up @@ -54,6 +52,4 @@ extract results:

.. rst-class:: sphx-glr-script-out

Out:

.. figure:: images/plotting/simple_example.png
130 changes: 124 additions & 6 deletions docs/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,134 @@
Getting started
===============

DPF-Core is a Python gRPC client communicating with the ``Ans.Dpf.Grpc``
server. To use the native DPF server, you must have a local installation of
Ansys 2021 R1 or later. For more information on getting a licensed copy of Ansys,
visit the `Ansys website <https://www.ansys.com/>`_.
The Data Processing Framework (DPF) provides numerical simulation users and engineers with a toolbox
for accessing and transforming simulation data. DPF can access data from Ansys solver
result (RST) files as well as from several neutral file formats, including CSV, HDF5, and VTK.
This **workflow-based** framework allows you to perform complex preprocessing and
postprocessing operations on large amounts of simulation data.

PyDPF-Core is a Python client API communicating with a **DPF Server**, either
through the network using gRPC or directly in the same process.


Installing PyDPF-Core
---------------------

In a Python environment, run the following command to install PyDPF-Core:

.. code::

pip install ansys-dpf-core

For more installation options, see :ref:`Installation section <installation>`.


Installing DPF Server
---------------------

#. DPF Server is packaged within the **Ansys Unified Installer** starting with Ansys 2021 R1.
To use it, install Ansys following the installer instructions. If you experience problems,
see :ref:`Environment variable section <ref_compatibility>`. For information on getting
a licensed copy of Ansys, visit the `Ansys website <https://www.ansys.com/>`_.

#. DPF Server is available as a **standalone** package (independent of the Ansys installer) on the `Ansys Customer Portal <https://support.ansys.com/Home/HomePage>`_.
As explained in :ref:`Ansys licensing section <ref_getting_started_with_dpf_server>`,
DPF Server is protected by an Ansys license mechanism. Once you have access to an
Ansys license, install DPF Server:

.. card::

* Download the ansys_dpf_server_win_v2023.2.pre0.zip or ansys_dpf_server_lin_v2023.2.pre0.zip
file as appropriate.
* Unzip the package and go to the root folder of the unzipped package
(ansys_dpf_server_win_v2023.2.pre0 or ansys_dpf_server_lin_v2023.2.pre0).
* In a Python environment, run the following command:

.. code::

pip install -e .

* DPF Server is protected using the license terms specified in the
``DPFUserLicensingAgreement.txt`` file, which is available on the
Ansys Customer Portal. To accept these terms, you must set the
following environment flag:

.. code::

ANSYS_DPF_ACCEPT_LA=Y



For installation methods that do not use pip, such as using **Docker containers**, see
:ref:`ref_getting_started_with_dpf_server`.


Use PyDPF-Core
--------------

In the same Python environment, run the following command to use PyDPF-Core:

.. code:: python

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> model = dpf.Model(examples.download_crankshaft())
>>> print(model)


.. rst-class:: sphx-glr-script-out

.. code-block:: none

DPF Model
------------------------------
Static analysis
Unit system: MKS: m, kg, N, s, V, A, degC
Physics Type: Mechanical
Available results:
- displacement: Nodal Displacement
- velocity: Nodal Velocity
- acceleration: Nodal Acceleration
- reaction_force: Nodal Force
- stress: ElementalNodal Stress
- elemental_volume: Elemental Volume
- stiffness_matrix_energy: Elemental Energy-stiffness matrix
- artificial_hourglass_energy: Elemental Hourglass Energy
- thermal_dissipation_energy: Elemental thermal dissipation energy
- kinetic_energy: Elemental Kinetic Energy
- co_energy: Elemental co-energy
- incremental_energy: Elemental incremental energy
- elastic_strain: ElementalNodal Strain
- structural_temperature: ElementalNodal Temperature
------------------------------
DPF Meshed Region:
69762 nodes
39315 elements
Unit: m
With solid (3D) elements
------------------------------
DPF Time/Freq Support:
Number of sets: 3
Cumulative Time (s) LoadStep Substep
1 1.000000 1 1
2 2.000000 1 2
3 3.000000 1 3



.. code:: python

>>> over_time_disp = model.results.displacement().eval()
>>> over_time_disp[0].plot()


.. figure:: ../images/plotting/crankshaft_disp.png


.. toctree::
:maxdepth: 3
:hidden:

compatibility
install
dependencies
docker
PProfizi marked this conversation as resolved.
Show resolved Hide resolved

Binary file added docs/source/images/plotting/crankshaft_disp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 0 additions & 17 deletions docs/source/user_guide/fields_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ This example uses the ``elastic_strain`` operator to access a fields container:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF elastic_strain(s)Fields Container
Expand Down Expand Up @@ -76,8 +74,6 @@ Access the field:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

20
Expand Down Expand Up @@ -105,7 +101,6 @@ To access fields for more complex requests, you can use the

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

Expand All @@ -130,8 +125,6 @@ Here is a more real-word example:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF elastic_strain_1.s_elshape:0 Field
Expand Down Expand Up @@ -159,8 +152,6 @@ time complex IDs are available in the fields container:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF Time/Freq Support:
Expand Down Expand Up @@ -216,8 +207,6 @@ You can get an overview of a field's metadata by printing the field:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF elastic_strain_0.01s Field
Expand Down Expand Up @@ -246,8 +235,6 @@ To access the scoping of the field, use the ``scoping`` attribute:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF scoping:
Expand Down Expand Up @@ -301,8 +288,6 @@ units of the data:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

'Pa'
Expand Down Expand Up @@ -451,8 +436,6 @@ average of a field:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

[[ 4.65393066e-04 -2.47955322e-05 0.00000000e+00 7.68026390e+02
Expand Down
10 changes: 0 additions & 10 deletions docs/source/user_guide/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ To understand what is available in the result file, you can print the model

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF Model
Expand Down Expand Up @@ -88,8 +86,6 @@ This example shows you get the analysis type:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

'static'
Expand All @@ -105,8 +101,6 @@ This example shows how you get mesh information:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

3751
Expand All @@ -128,8 +122,6 @@ This example shows how you get time sets:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

[1.]
Expand All @@ -151,8 +143,6 @@ This example shows how you view available results:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

Static analysis
Expand Down
18 changes: 0 additions & 18 deletions docs/source/user_guide/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ operator by printing it:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF U Operator:
Expand Down Expand Up @@ -138,8 +136,6 @@ Because several other examples use the ``Model`` class, this example uses the

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF DataSources:
Expand Down Expand Up @@ -179,8 +175,6 @@ class from the operator:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPF displacement(s)Fields Container
Expand All @@ -202,8 +196,6 @@ like this one:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

DPFServerException: U<-Data sources are not defined.
Expand Down Expand Up @@ -240,8 +232,6 @@ displacement data on the client side to compute the maximum:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

array([8.20217171e-07, 6.26510654e-06, 0.00000000e+00])
Expand All @@ -262,8 +252,6 @@ On an industrial model, however, you should use code like this:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

array([8.20217171e-07, 6.26510654e-06, 0.00000000e+00])
Expand Down Expand Up @@ -374,8 +362,6 @@ operators:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

array([[ 2., 4., 6.],
Expand All @@ -394,8 +380,6 @@ operators:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

array([[4., 5., 6.],
Expand Down Expand Up @@ -448,8 +432,6 @@ Python client is not on the same machine as the server:

.. rst-class:: sphx-glr-script-out

Out:

.. code-block:: none

C:\Users\cbellot\AppData\Local\Temp\dataProcessingTemp17168
Expand Down