diff --git a/.ci/collect_mapdl_logs.sh b/.ci/collect_mapdl_logs.sh new file mode 100755 index 0000000000..57ce2bedaf --- /dev/null +++ b/.ci/collect_mapdl_logs.sh @@ -0,0 +1,45 @@ +#!/bin/bash +if [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then + echo "It is an ubuntu based image" + export FILE=/jobs/file + export WDIR='/jobs/' + +else + echo "It is a CentOS based image" + export FILE=file + export WDIR="" + +fi; + + +mkdir "$LOG_NAMES" && echo "Successfully generated directory $LOG_NAMES" + +#### +echo "Collecting MAPDL logs..." + +(docker exec "$MAPDL_INSTANCE" /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'") || echo "Failed to create a directory inside docker container for logs." +(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.out' > /dev/null ;then cp -f /file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi") || echo "Failed to copy the 'out' files into a local file" +(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.err' > /dev/null ;then cp -f /file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi") || echo "Failed to copy the 'err' files into a local file" +(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$FILE*.log' > /dev/null ;then cp -f /file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi") || echo "Failed to copy the 'log' files into a local file" +(docker exec "$MAPDL_INSTANCE" /bin/bash -c "if compgen -G '$WDIR*.crash' > /dev/null ;then cp -f /*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi") || echo "Failed to copy the 'crash' files into a local file" + +docker cp "$MAPDL_INSTANCE":/mapdl_logs/. ./"$LOG_NAMES"/. || echo "Failed to copy the 'log-build-docs' files into a local directory" + +#### +echo "Collecting local build logs..." + +echo "Collecting docker run log..." +cp log.txt ./"$LOG_NAMES"/log.txt || echo "MAPDL run docker log not found." + +echo "Copying docker launch log..." +cp mapdl_launch_0.log ./"$LOG_NAMES"/mapdl_launch_0.log || echo "MAPDL launch docker log not found." +cp mapdl_launch_1.log ./"$LOG_NAMES"/mapdl_launch_1.log || echo "MAPDL launch docker log not found." + +echo "Collecting file structure..." +ls -R > ./"$LOG_NAMES"/files_structure.txt || echo "Failed to copy file structure to a file" + +echo "Collecting docker file structure..." +docker exec "$MAPDL_INSTANCE" /bin/bash -c "ls -R" > ./"$LOG_NAMES"/docker_files_structure.txt || echo "Failed to copy the docker structure into a local file" + +echo "Tar files..." +tar cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress" \ No newline at end of file diff --git a/.ci/display_logs.sh b/.ci/display_logs.sh new file mode 100755 index 0000000000..5ff0c27124 --- /dev/null +++ b/.ci/display_logs.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +echo "::group:: Display files structure" && ls -R && echo "::endgroup::" + + +echo "::group:: Display files structure" && docker exec "$MAPDL_INSTANCE" /bin/bash -c "ls -R" && echo "::endgroup::" || echo "Failed to display the docker structure." + + +echo "::group:: Display docker run log" && cat log.txt && echo "::endgroup::" + +# Displaying MAPDL files +FILE_PAT=./"$LOG_NAMES"/*.err +if compgen -G "$FILE_PAT" > /dev/null ;then for f in "$FILE_PAT"; do echo "::group:: Error file $f" && cat "$f" && echo "::endgroup::" ; done; fi || echo "Failed to display the 'out' files." + +FILE_PAT=./"$LOG_NAMES"/*.log +if compgen -G "$FILE_PAT" > /dev/null ;then for f in "$FILE_PAT"; do echo "::group:: Log file $f" && cat "$f" && echo "::endgroup::" ; done; fi || echo "Failed to display the 'err' files." + +FILE_PAT=./"$LOG_NAMES"/*.out +if compgen -G "$FILE_PAT" > /dev/null ;then for f in "$FILE_PAT"; do echo "::group:: Output file $f" && cat "$f" && echo "::endgroup::" ; done; fi || echo "Failed to display the 'log' files." + diff --git a/.ci/start_mapdl.sh b/.ci/start_mapdl.sh index f69a2f8dab..68d028c4a4 100755 --- a/.ci/start_mapdl.sh +++ b/.ci/start_mapdl.sh @@ -1,7 +1,40 @@ #!/bin/bash +echo "MAPDL Instance name: $INSTANCE_NAME" +echo "MAPDL_VERSION: $MAPDL_VERSION" + +export MAPDL_IMAGE="$MAPDL_PACKAGE:$MAPDL_VERSION" +echo "MAPDL_IMAGE: $MAPDL_IMAGE" docker pull "$MAPDL_IMAGE" + +export MAJOR=$(echo "$MAPDL_VERSION" | head -c 3 | tail -c 2) +export MINOR=$(echo "$MAPDL_VERSION" | head -c 5 | tail -c 1) + +export VERSION="$MAJOR$MINOR" +echo "MAPDL VERSION: $VERSION" + + +if [[ $MAPDL_VERSION == *"latest-ubuntu"* ]]; then + echo "It is latest-ubuntu. Using 'ansys' script to launch" + export EXEC_PATH=ansys + # export P_SCHEMA=/ansys_inc/ansys/ac4/schema + +elif [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then + echo "It is an ubuntu based image" + export EXEC_PATH=/ansys_inc/v$VERSION/ansys/bin/mapdl + export P_SCHEMA=/ansys_inc/v$VERSION/ansys/ac4/schema + +else + echo "It is a CentOS based image" + export EXEC_PATH=/ansys_inc/ansys/bin/mapdl + export P_SCHEMA=/ansys_inc/ansys/ac4/schema +fi; + +echo "EXEC_PATH: $EXEC_PATH" +echo "P_SCHEMA: $P_SCHEMA" + docker run \ - --name mapdl \ + --entrypoint "/bin/bash" \ + --name "$INSTANCE_NAME" \ --restart always \ --health-cmd="ps aux | grep \"[/]ansys_inc/.*ansys\.e.*grpc\" -q && echo 0 || echo 1" \ --health-interval=0.5s \ @@ -12,12 +45,13 @@ docker run \ -e ANSYS_LOCK="OFF" \ -p "$PYMAPDL_PORT":50052 \ -p "$PYMAPDL_DB_PORT":50055 \ - --shm-size=1gb \ + --shm-size=2gb \ -e I_MPI_SHM_LMT=shm \ - -e P_SCHEMA=/ansys_inc/ansys/ac4/schema \ - --oom-kill-disable \ - --memory=6656MB \ + -e P_SCHEMA="$P_SCHEMA" \ + -w /jobs \ + -u=0:0 \ + --memory=6656MB \ --memory-swap=16896MB \ - "$MAPDL_IMAGE" \ - -"$DISTRIBUTED_MODE" -np 2 > log.txt & + "$MAPDL_IMAGE" "$EXEC_PATH" -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt & + grep -q 'Server listening on' <(timeout 60 tail -f log.txt) diff --git a/.ci/start_mapdl_student.sh b/.ci/start_mapdl_student.sh deleted file mode 100755 index 2c927913b2..0000000000 --- a/.ci/start_mapdl_student.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -docker pull "$MAPDL_IMAGE" -docker run \ - --entrypoint "/bin/bash" \ - --name mapdl \ - --restart always \ - -e ANSYS_LOCK="OFF" \ - -p "$PYMAPDL_PORT":50052 \ - -p "$PYMAPDL_DB_PORT":50055 \ - --shm-size=1gb \ - -e I_MPI_SHM_LMT=shm \ - -e P_SCHEMA=/ansys_inc/v241/ansys/ac4/schema \ - -w /jobs \ - -u=0:0 \ - --memory=6656MB \ - --memory-swap=16896MB \ - "$MAPDL_IMAGE" /ansys_inc/v241/ansys/bin/mapdl -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt & -# grep -q 'Server listening on' <(timeout 60 tail -f log.txt) diff --git a/.ci/start_mapdl_ubuntu.sh b/.ci/start_mapdl_ubuntu.sh deleted file mode 100755 index 123e4a789c..0000000000 --- a/.ci/start_mapdl_ubuntu.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -docker pull "$MAPDL_IMAGE" -docker run \ - --entrypoint "/bin/bash" \ - --name mapdl \ - --restart always \ - --health-cmd="ps aux | grep \"[/]ansys_inc/.*ansys\.e.*grpc\" -q && echo 0 || echo 1" \ - --health-interval=0.5s \ - --health-retries=4 \ - --health-timeout=0.5s \ - --health-start-period=10s \ - -e ANSYSLMD_LICENSE_FILE=1055@"$LICENSE_SERVER" \ - -e ANSYS_LOCK="OFF" \ - -p "$PYMAPDL_PORT":50052 \ - -p "$PYMAPDL_DB_PORT":50055 \ - --shm-size=1gb \ - -e I_MPI_SHM_LMT=shm \ - -e P_SCHEMA=/ansys_inc/v222/ansys/ac4/schema \ - -w /jobs \ - -u=0:0 \ - --memory=6656MB \ - --memory-swap=16896MB \ - "$MAPDL_IMAGE" /ansys_inc/v222/ansys/bin/mapdl -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt & -grep -q 'Server listening on' <(timeout 60 tail -f log.txt) diff --git a/.ci/substitute_defective_gif.sh b/.ci/substitute_defective_gif.sh new file mode 100755 index 0000000000..2bd71b3e4b --- /dev/null +++ b/.ci/substitute_defective_gif.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd doc/_build/html/examples/gallery_examples/00-mapdl-examples +cp ../../../../../source/images/dcb.gif ../../../_images/ +sed -i 's+../../../_images/sphx_glr_composite_dcb_004.gif+../../../_images/dcb.gif+g' composite_dcb.html +cd ../../../../../../ \ No newline at end of file diff --git a/.ci/waiting_services.sh b/.ci/waiting_services.sh new file mode 100755 index 0000000000..b2050ef89d --- /dev/null +++ b/.ci/waiting_services.sh @@ -0,0 +1,19 @@ +#!/bin/bash +echo "Waiting for the MAPDL service to be up..." +nc -v -z localhost "$PYMAPDL_PORT" +echo "::group:: ps aux Output" && ps aux && echo "::endgroup::" + +echo "Waiting for MAPDL port is open..." +echo "::group:: Waiting for the MAPDL port to be open..." +while ! nc -z localhost "$PYMAPDL_PORT"; do +sleep 0.1 +done +echo "::endgroup::" +echo "MAPDL service is up!" + +echo "::group:: Waiting for the DPF port to be open..." +while ! nc -z localhost "$DPF_PORT"; do + sleep 0.1 +done +echo "::endgroup::" +echo "DPF service is up!" \ No newline at end of file diff --git a/.devcontainer/codespaces-dev/requirements.txt b/.devcontainer/codespaces-dev/requirements.txt index 09f1d29a2e..d11f4997ba 100644 --- a/.devcontainer/codespaces-dev/requirements.txt +++ b/.devcontainer/codespaces-dev/requirements.txt @@ -1,14 +1,14 @@ ansys-dpf-core==0.10.1 -autopep8==2.0.4 +autopep8==2.1.0 matplotlib==3.8.3 scipy==1.12.0 -pandas==2.2.0 +pandas==2.2.1 pyiges[full]==0.3.1 -pytest==8.0.1 -pytest-cov==4.1.0 -pyvista==0.43.3 +pytest==8.1.1 +pytest-cov==5.0.0 +pyvista==0.43.4 pyansys-tools-report==0.7.0 vtk==9.3.0 -pytest-rerunfailures==13.0 +pytest-rerunfailures==14.0 pytest-pyvista==0.1.9 -pytest-timeout==2.2.0 \ No newline at end of file +pytest-timeout==2.3.1 \ No newline at end of file diff --git a/.devcontainer/codespaces-docs/requirements.txt b/.devcontainer/codespaces-docs/requirements.txt index 45070595a6..0e53904257 100644 --- a/.devcontainer/codespaces-docs/requirements.txt +++ b/.devcontainer/codespaces-docs/requirements.txt @@ -1,21 +1,21 @@ sphinx==7.2.6 ansys-dpf-core==0.10.1 ansys-mapdl-reader==0.53.0 -ansys-sphinx-theme==0.14.0 -grpcio==1.62.0 +ansys-sphinx-theme==0.14.1 +grpcio==1.62.1 imageio-ffmpeg==0.4.9 imageio==2.34.0 jupyter_sphinx==0.5.3 jupyterlab>=3.2.8 matplotlib==3.8.3 -numpydoc==1.6.0 -pandas==2.2.0 -plotly==5.19.0 +numpydoc==1.7.0 +pandas==2.2.1 +plotly==5.20.0 pyiges[full]==0.3.1 pypandoc==1.13 pytest-sphinx==0.6.0 pythreejs==2.4.2 -pyvista[trame]==0.43.3 +pyvista[trame]==0.43.4 sphinx-autobuild==2024.2.4 sphinx-autodoc-typehints==1.25.2 sphinx-copybutton==0.5.2 diff --git a/.devcontainer/devcontainer-local/requirements.txt b/.devcontainer/devcontainer-local/requirements.txt index 09f1d29a2e..d11f4997ba 100644 --- a/.devcontainer/devcontainer-local/requirements.txt +++ b/.devcontainer/devcontainer-local/requirements.txt @@ -1,14 +1,14 @@ ansys-dpf-core==0.10.1 -autopep8==2.0.4 +autopep8==2.1.0 matplotlib==3.8.3 scipy==1.12.0 -pandas==2.2.0 +pandas==2.2.1 pyiges[full]==0.3.1 -pytest==8.0.1 -pytest-cov==4.1.0 -pyvista==0.43.3 +pytest==8.1.1 +pytest-cov==5.0.0 +pyvista==0.43.4 pyansys-tools-report==0.7.0 vtk==9.3.0 -pytest-rerunfailures==13.0 +pytest-rerunfailures==14.0 pytest-pyvista==0.1.9 -pytest-timeout==2.2.0 \ No newline at end of file +pytest-timeout==2.3.1 \ No newline at end of file diff --git a/.github/workflows/cache_cleaner.yml b/.github/workflows/cache_cleaner.yml index 7afa87ac59..89decf0584 100644 --- a/.github/workflows/cache_cleaner.yml +++ b/.github/workflows/cache_cleaner.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.2 - name: Cleanup PR caches if: github.event_name != 'workflow_dispatch' @@ -26,9 +26,15 @@ jobs: ## Setting this to not fail the workflow while deleting cache keys. set +e echo "Deleting caches..." - for cacheKey in $cacheKeysForPR + + while [ ! -z "$cacheKeysForPR" ]; do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm && echo "Deleting cache with key: $cacheKey" + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm && echo "Deleting cache with key: $cacheKey" + done + + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) done echo "Done" env: @@ -48,9 +54,14 @@ jobs: ## Setting this to not fail the workflow while deleting cache keys. set +e echo "Deleting caches..." - for cacheKey in $cacheKeysForPR + while [ ! -z "$cacheKeysForPR" ]; do - gh actions-cache delete $cacheKey -R $REPO --confirm && echo "Deleting cache with key: $cacheKey" + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO --confirm && echo "Deleting cache with key: $cacheKey" + done + + cacheKeysForPR=$(gh actions-cache list -R $REPO | cut -f 1 ) done echo "Done" env: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 297182fe7b..07ccdf179d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,11 +28,11 @@ env: MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} PYANSYS_OFF_SCREEN: True DPF_START_SERVER: False - DPF_PORT: 21002 - DOCKER_PACKAGE: ghcr.io/ansys/mapdl - DOCKER_IMAGE_VERSION_DOCS_BUILD: v24.1-ubuntu-student + DPF_PORT: 21004 + MAPDL_PACKAGE: ghcr.io/ansys/mapdl + MAPDL_IMAGE_VERSION_DOCS_BUILD: v24.1-ubuntu-student ON_CI: True - PYTEST_ARGUMENTS: '-vv --durations=10 --maxfail=3 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html' + PYTEST_ARGUMENTS: '-vvv --durations=10 --maxfail=3 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html' # Following env vars when changed will "reset" the mentioned cache, # by changing the cache file name. It is rendered as ...-v%RESET_XXX%-... @@ -67,7 +67,6 @@ jobs: uses: ansys/actions/doc-style@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - version: 2.29.6 smoke-tests: name: Build and smoke test (${{ matrix.os }} | Python ${{ matrix.python-version }}) (Release=${{ matrix.should-release }}) @@ -116,7 +115,30 @@ jobs: ON_DOCUMENTATION: TRUE steps: - name: "Install Git and checkout project" - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.2 + + - name: "Login in Github container registry" + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "Pull, launch, and validate MAPDL service" + id: start_mapdl + env: + LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} + MAPDL_VERSION: ${{ env.MAPDL_IMAGE_VERSION_DOCS_BUILD }} + DISTRIBUTED_MODE: "dmp" + run: | + export INSTANCE_NAME=MAPDL_0 + .ci/start_mapdl.sh &> mapdl_launch.log & export DOCKER_PID=$! + echo "Launching MAPDL service at PID: $DOCKER_PID" + echo "DOCKER_PID=$(echo $DOCKER_PID)" >> $GITHUB_OUTPUT + + - name: "DPF server activation" + run: | + $(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}.") & - name: "Getting files change filters" uses: dorny/paths-filter@v3 @@ -125,6 +147,10 @@ jobs: filters: | workflows: - '.github/workflows/**' + - 'pyproject.toml' + examples: + - 'examples/**' + - 'pyproject.toml' - name: "Setup Python with cache" uses: actions/setup-python@v5 @@ -143,7 +169,6 @@ jobs: run: | sudo apt update sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk graphviz texlive-xetex texlive-fonts-extra qpdf texlive-xetex xindy - - name: "Test virtual framebuffer" run: | @@ -155,19 +180,6 @@ jobs: pip install . xvfb-run python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())" - - name: "Login in Github container registry" - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: "Pull, launch, and validate MAPDL service" - run: .ci/start_mapdl_student.sh - env: - MAPDL_IMAGE: '${{ env.DOCKER_PACKAGE }}:${{ env.DOCKER_IMAGE_VERSION_DOCS_BUILD }}' - DISTRIBUTED_MODE: "dmp" - - name: "Retrieve PyMAPDL version" id: version run: | @@ -176,7 +188,7 @@ jobs: - name: "Cache examples" uses: actions/cache@v4 - if: steps.changes.outputs.workflows != 'true' + if: steps.changes.outputs.examples != 'true' || (github.ref == 'refs/heads/main' && !contains(github.ref, 'refs/tags')) with: path: doc/source/examples key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }} @@ -185,7 +197,7 @@ jobs: - name: "Cache docs build directory" uses: actions/cache@v4 - if: steps.changes.outputs.workflows != 'true' + if: steps.changes.outputs.workflows != 'true' || (github.ref == 'refs/heads/main' && !contains(github.ref, 'refs/tags')) with: path: doc/_build key: doc-build-v${{ env.RESET_DOC_BUILD_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }} @@ -194,7 +206,7 @@ jobs: - name: "Cache autosummary" uses: actions/cache@v4 - if: steps.changes.outputs.workflows != 'true' + if: steps.changes.outputs.workflows != 'true' || (github.ref == 'refs/heads/main' && !contains(github.ref, 'refs/tags')) with: path: doc/source/**/_autosummary/*.rst key: autosummary-v${{ env.RESET_AUTOSUMMARY_CACHE }}-${{ steps.version.outputs.PYMAPDL_VERSION }}-${{ github.sha }} @@ -205,10 +217,9 @@ jobs: run: | pip install .[doc] - - name: "DPF server activation" + - name: "Waiting for the services to be up" run: | - docker pull ghcr.io/ansys/dpf-core:22.2dev - docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}." + .ci/waiting_services.sh - name: "Build documentation" run: | @@ -216,10 +227,7 @@ jobs: - name: "Substitute defective GIF" run: | - cd doc/_build/html/examples/gallery_examples/00-mapdl-examples - cp ../../../../../source/images/dcb.gif ../../../_images/ - sed -i 's+../../../_images/sphx_glr_composite_dcb_004.gif+../../../_images/dcb.gif+g' composite_dcb.html - cd ../../../../../../ + .ci/substitute_defective_gif.sh - name: "Upload HTML Documentation" uses: actions/upload-artifact@v4 @@ -250,36 +258,14 @@ jobs: name: minimum_requirements.txt path: ./minimum_requirements.txt - - name: "Display files structure" - if: always() - run: | - mkdir logs-build-docs - echo "::group:: Display files structure" && ls -R && echo "::endgroup::" - ls -R > ./logs-build-docs/files_structure.txt - - - name: "Display Docker files structures" - if: always() - run: | - echo "::group:: Display files structure" && docker exec mapdl /bin/bash -c "ls -R" && echo "::endgroup::" || echo "Failed to display the docker structure." - docker exec mapdl /bin/bash -c "ls -R" > ./logs-build-docs/docker_files_structure.txt || echo "Failed to copy the docker structure into a local file" - - - name: "Collect MAPDL logs on failure" - if: always() - run: | - docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" || echo "Failed to create a directory inside docker container for logs." - docker exec mapdl /bin/bash -c "if compgen -G 'file*.out' > /dev/null ;then cp -f /file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" || echo "Failed to copy the 'out' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G 'file*.err' > /dev/null ;then cp -f /file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" || echo "Failed to copy the 'err' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G 'file*.log' > /dev/null ;then cp -f /file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" || echo "Failed to copy the 'log' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G '*.crash' > /dev/null ;then cp -f /*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" || echo "Failed to copy the 'crash' files into a local file" - docker cp mapdl:/mapdl_logs/. ./logs-build-docs/. || echo "Failed to copy the 'log-build-docs' files into a local directory" - - - name: "Tar logs" + - name: "Collect logs on failure" if: always() + env: + MAPDL_VERSION: ${{ env.MAPDL_IMAGE_VERSION_DOCS_BUILD }} + MAPDL_INSTANCE: MAPDL_0 + LOG_NAMES: logs-build-docs run: | - cp -f doc/_build/latex/*.log ./logs-build-docs/ || echo "Latex logs could not be found." - - cp log.txt ./logs-build-docs/ || echo "MAPDL log could not be found." - tar cvzf ./logs-build-docs.tgz ./logs-build-docs + .ci/collect_mapdl_logs.sh - name: "Upload logs to GitHub" if: always() @@ -288,11 +274,13 @@ jobs: name: logs-build-docs.tgz path: ./logs-build-docs.tgz - - name: "Display MAPDL Logs" + - name: "Display files structure" if: always() - run: cat log.txt || echo "MAPDL log could not be found." - - + env: + MAPDL_INSTANCE: mapdl + LOG_NAMES: logs-build-docs + run: | + .ci/display_logs.sh build-test: name: "Remote: Build & test MAPDL ${{ matrix.mapdl-version }} (Extended testing ${{ matrix.extended_testing }})" @@ -302,25 +290,54 @@ jobs: strategy: fail-fast: false matrix: - mapdl-version: ['v22.2.1', 'v22.2-ubuntu', 'v23.1.0', 'v23.2.0', 'v24.1.0', 'v24.1-ubuntu-student'] + mapdl-version: [ + 'v22.2.1', + 'v22.2-ubuntu', + 'v23.1.0', + 'v23.1-ubuntu', + 'v23.2.0', + 'v23.2-ubuntu', + 'v24.1.0', + 'v24.1-ubuntu', + 'v24.1-ubuntu-student', + 'v24.2.0', + 'latest-ubuntu', + 'latest-ubuntu-student', + ] extended_testing: - ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && inputs.run_all_tests ) || ( github.event_name == 'push' && contains(github.ref, 'refs/tags') ) }} exclude: + # In PRs skipping all MAPDL version except student ones (commented out). - extended_testing: false mapdl-version: 'v22.2.1' - extended_testing: false mapdl-version: 'v22.2-ubuntu' - extended_testing: false mapdl-version: 'v23.1.0' + - extended_testing: false + mapdl-version: 'v23.1-ubuntu' - extended_testing: false mapdl-version: 'v23.2.0' - extended_testing: false - mapdl-version: 'v23.1.0' + mapdl-version: 'v23.2-ubuntu' - extended_testing: false mapdl-version: 'v24.1.0' + - extended_testing: false + mapdl-version: 'v24.1-ubuntu' + # - extended_testing: false + # mapdl-version: 'v24.1-ubuntu-student' + - extended_testing: false + mapdl-version: 'v24.2.0' + - extended_testing: false + mapdl-version: 'latest-ubuntu' + # - extended_testing: false + # mapdl-version: 'latest-ubuntu-student' + env: PYMAPDL_PORT: 21000 # default won't work on GitHub runners - PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners + PYMAPDL_PORT2: 21001 # for the pool testing and default won't work on GitHub runners + PYMAPDL_DB_PORT: 21002 # default won't work on GitHub runners + PYMAPDL_DB_PORT2: 21003 # default won't work on GitHub runners PYMAPDL_START_INSTANCE: FALSE ON_LOCAL: FALSE ON_UBUNTU: FALSE @@ -330,8 +347,50 @@ jobs: steps: - name: "Install Git and checkout project" - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.2 + + - name: "Login in Github container registry" + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "Getting SMP/DMP mode" + id: distributed_mode + run: | + image=${{ matrix.mapdl-version }} + export distributed_mode="smp" + if [[ $image == *".1."* ]]; then + export distributed_mode="dmp"; + fi + echo "Distributed mode: $distributed_mode" + echo "distributed_mode=$(echo $distributed_mode)" >> $GITHUB_OUTPUT + + - name: "Pull, launch, and validate MAPDL service" + id: start_mapdl + env: + LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} + MAPDL_VERSION: ${{ matrix.mapdl-version }} + DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }} + run: | + echo "Launching first MAPDL instance..." + export INSTANCE_NAME=MAPDL_0 + .ci/start_mapdl.sh &> mapdl_launch_0.log & export DOCKER_PID_0=$! + echo "Launching a second instance for MAPDL pool testing..." + export PYMAPDL_PORT=${{ env.PYMAPDL_PORT2 }} + export PYMAPDL_DB_PORT=${{ env.PYMAPDL_DB_PORT2 }} + export INSTANCE_NAME=MAPDL_1 + .ci/start_mapdl.sh &> mapdl_launch_1.log & export DOCKER_PID_1=$! + echo "Launching MAPDL service 0 at PID: $DOCKER_PID_0" + echo "Launching MAPDL service 1 at PID: $DOCKER_PID_2" + echo "DOCKER_PID_0=$(echo $DOCKER_PID_0)" >> $GITHUB_OUTPUT + echo "DOCKER_PID_1=$(echo $DOCKER_PID_1)" >> $GITHUB_OUTPUT + - name: "DPF server activation" + run: | + $(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}.") & + - name: "Getting files change filters" uses: dorny/paths-filter@v3 id: changes @@ -370,64 +429,20 @@ jobs: python -m pip install dist/*.whl xvfb-run python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())" - - name: "Login in Github container registry" - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: "Getting SMP/DMP mode" - id: distributed_mode - run: | - image=${{ matrix.mapdl-version }} - export distributed_mode="smp" - if [[ $image == *".1."* ]]; then - export distributed_mode="dmp"; - fi - echo "Distributed mode: $distributed_mode" - echo "distributed_mode=$(echo $distributed_mode)" >> $GITHUB_OUTPUT - - - name: "Pull, launch, and validate MAPDL service" - env: - LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - run: | - export MAPDL_VERSION=${{ matrix.mapdl-version }} - export MAPDL_IMAGE=${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }} - export DISTRIBUTED_MODE=${{ steps.distributed_mode.outputs.distributed_mode }} - - echo "MAPDL_VERSION: $MAPDL_VERSION" - echo "MAPDL_IMAGE: $MAPDL_IMAGE" - - if [[ $MAPDL_VERSION == *"ubuntu-student"* ]] ; then - echo "It is student version (ubuntu-based)." - echo "No license server is needed." - .ci/start_mapdl_student.sh - - elif [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then - echo "It is an ubuntu based image" - .ci/start_mapdl_ubuntu.sh - - else - echo "It is a CentOS based image" - .ci/start_mapdl.sh - - fi; - - name: "Unit testing requirements installation" run: | python -m pip install .[tests] - - name: "DPF server activation" + - name: "Waiting for the services to be up" run: | - docker pull ghcr.io/ansys/dpf-core:22.2dev - docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}." + .ci/waiting_services.sh - name: "Unit testing" env: DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }} run: | - if [[ "${{ matrix.mapdl-version }}" == *"ubuntu"* ]]; then export ON_UBUNTU=true;fi + if [[ "${{ matrix.mapdl-version }}" == *"ubuntu"* ]]; then export ON_UBUNTU=true; else export ON_UBUNTU=false; fi + echo "ON_UBUNTU: $ON_UBUNTU" xvfb-run pytest \ ${{ env.PYTEST_ARGUMENTS }} \ --ignore_image_cache \ @@ -436,6 +451,7 @@ jobs: - uses: codecov/codecov-action@v4 name: "Upload coverage to Codecov" with: + token: ${{ secrets.CODECOV_TOKEN }} # required name: centos-${{ matrix.mapdl-version }}-remote.xml flags: centos,remote,${{ matrix.mapdl-version }} @@ -457,44 +473,14 @@ jobs: path: dist/ retention-days: 7 - - name: "Display files structure" - if: always() - run: | - mkdir logs-${{ matrix.mapdl-version }} && echo "Successfully generated directory ${{ matrix.mapdl-version }}" - echo "::group:: Display files structure" && ls -R && echo "::endgroup::" - ls -R > ./logs-${{ matrix.mapdl-version }}/files_structure.txt - - - name: "Display docker files structures" - if: always() - run: | - echo "::group:: Display files structure" && docker exec mapdl /bin/bash -c "ls -R" && echo "::endgroup::" - docker exec mapdl /bin/bash -c "ls -R" > ./logs-${{ matrix.mapdl-version }}/docker_files_structure.txt || echo "Failed to copy the docker structure into a local file" - - - name: "Collect MAPDL logs on failure" - if: ${{ always() && !contains( matrix.mapdl-version, 'ubuntu') }} - run: | - docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" || echo "Failed to create a directory inside docker container for logs." - docker exec mapdl /bin/bash -c "if compgen -G 'file*.out' > /dev/null ;then cp -f /file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" || echo "Failed to copy the 'out' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G 'file*.err' > /dev/null ;then cp -f /file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" || echo "Failed to copy the 'err' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G 'file*.log' > /dev/null ;then cp -f /file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" || echo "Failed to copy the 'log' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G '*.crash' > /dev/null ;then cp -f /*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" || echo "Failed to copy the 'crash' files into a local file" - docker cp mapdl:/mapdl_logs/. ./logs-${{ matrix.mapdl-version }}/. - - - name: "Collect MAPDL logs on failure for ubuntu image" - if: ${{ always() && contains( matrix.mapdl-version,'ubuntu') }} - run: | - docker exec mapdl /bin/bash -c "mkdir -p /mapdl_logs && echo 'Successfully created directory inside docker container'" || echo "Failed to create a directory inside docker container for logs." - docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.out' > /dev/null ;then cp -f /jobs/file*.out /mapdl_logs && echo 'Successfully copied out files.'; fi" || echo "Failed to copy the 'out' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.err' > /dev/null ;then cp -f /jobs/file*.err /mapdl_logs && echo 'Successfully copied err files.'; fi" || echo "Failed to copy the 'err' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G '/jobs/file*.log' > /dev/null ;then cp -f /jobs/file*.log /mapdl_logs && echo 'Successfully copied log files.'; fi" || echo "Failed to copy the 'log' files into a local file" - docker exec mapdl /bin/bash -c "if compgen -G '/jobs/*.crash' > /dev/null ;then cp -f /jobs/*.crash /mapdl_logs && echo 'Successfully copied crash files.'; fi" || echo "Failed to copy the 'crash' files into a local file" - docker cp mapdl:/mapdl_logs/. ./logs-${{ matrix.mapdl-version }}/. - - - name: "Tar logs" + - name: "Collect logs on failure" if: always() + env: + MAPDL_VERSION: ${{ matrix.mapdl-version }} + MAPDL_INSTANCE: mapdl + LOG_NAMES: logs-${{ matrix.mapdl-version }} run: | - cp log.txt ./logs-${{ matrix.mapdl-version }}/log.txt || echo "MAPDL log not found." - tar cvzf ./logs-${{ matrix.mapdl-version }}.tgz ./logs-${{ matrix.mapdl-version }} || echo "Failed to compress" + .ci/collect_mapdl_logs.sh - name: "Upload logs to GitHub" if: always() @@ -503,17 +489,13 @@ jobs: name: logs-${{ matrix.mapdl-version }}.tgz path: ./logs-${{ matrix.mapdl-version }}.tgz - - name: "Display MAPDL Logs" - if: always() - run: cat log.txt - - - name: "List main files" + - name: "Display files structure" if: always() + env: + MAPDL_INSTANCE: mapdl + LOG_NAMES: logs-${{ matrix.mapdl-version }} run: | - if compgen -G './logs-${{ matrix.mapdl-version }}/*.err' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.err; do echo "::group:: Error file $f" && cat $f && echo "::endgroup::" ; done; fi || echo "Failed to display the 'out' files." - if compgen -G './logs-${{ matrix.mapdl-version }}/*.log' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.log; do echo "::group:: Log file $f" && cat $f && echo "::endgroup::" ; done; fi || echo "Failed to display the 'err' files." - if compgen -G './logs-${{ matrix.mapdl-version }}/*.out' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.out; do echo "::group:: Output file $f" && cat $f && echo "::endgroup::" ; done; fi || echo "Failed to display the 'log' files." - + .ci/display_logs.sh build-test-ubuntu: name: "Local: Build & test on Ubuntu MAPDL ${{ matrix.mapdl-image }} (Extended testing ${{ matrix.extended_testing }})" @@ -527,7 +509,13 @@ jobs: strategy: fail-fast: false matrix: - mapdl-image: ['v23.2-ubuntu', 'v24.1-ubuntu', 'v24.1-ubuntu-student'] + mapdl-image: [ + 'v23.2-ubuntu', + 'v24.1-ubuntu', + 'v24.1-ubuntu-student', + 'latest-ubuntu', + 'latest-ubuntu-student', + ] extended_testing: - ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && inputs.run_all_tests ) || ( github.event_name == 'push' && contains(github.ref, 'refs/tags') ) }} exclude: @@ -535,6 +523,8 @@ jobs: mapdl-image: 'v23.2-ubuntu' - extended_testing: false mapdl-image: 'v24.1-ubuntu' + - extended_testing: false + mapdl-image: 'latest-ubuntu' container: image: ghcr.io/ansys/mapdl:${{ matrix.mapdl-image }} options: -u=0:0 --oom-kill-disable --memory=6656MB --memory-swap=16896MB --shm-size=1gb --entrypoint /bin/bash @@ -550,7 +540,7 @@ jobs: steps: - name: "Install Git and checkout project" - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.2 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} @@ -633,6 +623,7 @@ jobs: - uses: codecov/codecov-action@v4 name: "Upload coverage to Codecov" with: + token: ${{ secrets.CODECOV_TOKEN }} # required root_dir: ${{ github.workspace }} name: ${{ matrix.mapdl-image }}-local.xml flags: ubuntu,local,${{ matrix.mapdl-image }} @@ -652,7 +643,13 @@ jobs: strategy: fail-fast: false matrix: - mapdl-image: ['v23.2-ubuntu', 'v24.1-ubuntu', 'v24.1-ubuntu-student'] + mapdl-image: [ + 'v23.2-ubuntu', + 'v24.1-ubuntu', + 'v24.1-ubuntu-student', + 'latest-ubuntu', + 'latest-ubuntu-student', + ] extended_testing: - ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && inputs.run_all_tests ) || ( github.event_name == 'push' && contains(github.ref, 'refs/tags') ) }} exclude: @@ -660,6 +657,8 @@ jobs: mapdl-image: 'v23.2-ubuntu' - extended_testing: false mapdl-image: 'v24.1-ubuntu' + - extended_testing: false + mapdl-image: 'latest-ubuntu' container: image: ghcr.io/ansys/mapdl:${{ matrix.mapdl-image }} options: -u=0:0 --oom-kill-disable --memory=6656MB --memory-swap=16896MB --shm-size=1gb --entrypoint /bin/bash @@ -673,7 +672,7 @@ jobs: steps: - name: "Install Git and checkout project" - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.2 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} @@ -709,7 +708,13 @@ jobs: run: | # Because there is no 'ansys-tools-path' we need to input the # executable path with the env var: PYMAPDL_MAPDL_EXEC. - version=$(echo "${{ matrix.mapdl-image }}" | head -c 5 | tail -c 4 | tr -d '.') + + if [[ "${{ matrix.mapdl-image }}" == *"latest-ubuntu"* ]] ; then + version="242" + else + version=$(echo "${{ matrix.mapdl-image }}" | head -c 5 | tail -c 4 | tr -d '.') + fi; + echo "$version" export PYMAPDL_MAPDL_EXEC=/ansys_inc/v"$version"/ansys/bin/ansys"$version" @@ -723,6 +728,7 @@ jobs: - uses: codecov/codecov-action@v4 name: "Upload coverage to Codecov" with: + token: ${{ secrets.CODECOV_TOKEN }} # required root_dir: ${{ github.workspace }} name: ${{ matrix.mapdl-image }}-minimal.xml flags: ubuntu,local,${{ matrix.mapdl-image }},minimal @@ -735,6 +741,7 @@ jobs: test-windows: + # Skipped if: github.repository == '' name: "Local: Build & test on Windows" runs-on: [self-hosted, Windows, pymapdl] @@ -743,7 +750,7 @@ jobs: ON_LOCAL: TRUE steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.2 # Skipping because it is installed locally. # - name: Setup Python @@ -794,6 +801,7 @@ jobs: - uses: codecov/codecov-action@v4 name: "Upload coverage to Codecov" with: + token: ${{ secrets.CODECOV_TOKEN }} # required name: windows-v22.2.0-local.xml flags: windows,local,v22.2.0 @@ -829,7 +837,7 @@ jobs: run: ls -Rla - name: "Release to GitHub" - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: files: | ./**/artifacts/ansys_mapdl_core-*-py3-none-any.whl @@ -847,18 +855,6 @@ jobs: twine upload --skip-existing ./**/*.whl twine upload --skip-existing ./**/*.tar.gz - - name: "Notify if fail" - uses: skitionek/notify-microsoft-teams@master - if: ${{ failure() }} - with: - webhook_url: ${{ secrets.TEAM_HOOK }} - needs: ${{ toJson(needs) }} - job: ${{ toJson(job) }} - steps: ${{ toJson(steps) }} - overwrite: "{ - title: `Release FAILED!`, - }" - upload-docs-release: name: "Upload release documentation" @@ -867,11 +863,12 @@ jobs: needs: [release] steps: - name: Deploy the stable documentation - uses: ansys/actions/doc-deploy-stable@v5 + # TODO: testing SEO improvements. This branch avoids creating a + # sitemap.xml pages in opposite to v5. + uses: ansys/actions/doc-deploy-stable@feat/seo-improvements with: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} - python-version: ${{ env.MAIN_PYTHON_VERSION }} render-last: '5' @@ -881,7 +878,7 @@ jobs: needs: upload-docs-release steps: - name: "Install Git and clone project" - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.2 - name: "Install the package requirements" run: pip install -e . @@ -911,7 +908,8 @@ jobs: needs: [docs-build] steps: - name: Deploy the latest documentation - uses: ansys/actions/doc-deploy-dev@v5 + # TODO: testing SEO improvements. This branch reuses the "index.html" from the stable version + uses: ansys/actions/doc-deploy-dev@feat/seo-improvements with: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} @@ -943,3 +941,36 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} title-template: "Failed scheduled build" label-name: "Build failed" + + test_julia: + name: "Test julia implementation" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + julia-version: ['1.10.2'] # '1.6.7' + os: [ubuntu-latest, windows-latest] + + steps: + - uses: actions/checkout@v4.1.2 + - name: "Set up Julia" + uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.julia-version }} + + - name: "Getting python interpreter" + id: get_python + run: | + pycallpython=$(julia -e 'using Pkg;Pkg.add("PyCall");using PyCall;println(PyCall.python)') + echo "pythonpath=$(echo $pycallpython)" >> $GITHUB_OUTPUT + + - name: Installing pymapdl + env: + PYTHON_PATH: ${{ steps.get_python.outputs.pythonpath }} + run: | + "$PYTHON_PATH" -m pip install -e . + + - name: "Starting julia" + shell: julia {0} + run: | + using Pkg; Pkg.add("PyCall");using PyCall;pymapdl = pyimport("ansys.mapdl.core");print(pymapdl.__version__) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index c9500aee61..e6a541d5c0 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -18,7 +18,7 @@ jobs: name: Syncer runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.2 - uses: micnncim/action-label-syncer@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/linkchecker.yml b/.github/workflows/linkchecker.yml index 499547b10d..280cd3a210 100644 --- a/.github/workflows/linkchecker.yml +++ b/.github/workflows/linkchecker.yml @@ -11,9 +11,9 @@ concurrency: env: ON_CI: True - DOCKER_PACKAGE: ghcr.io/ansys/mapdl - DOCKER_IMAGE_VERSION_DOCS_BUILD: v23.1.0 - MAIN_PYTHON_VERSION: '3.9' + MAPDL_PACKAGE: ghcr.io/ansys/mapdl + MAPDL_IMAGE_VERSION_DOCS_BUILD: v24.1.0 + MAIN_PYTHON_VERSION: '3.10' PYANSYS_OFF_SCREEN: True DPF_START_SERVER: False DPF_PORT: 21002 @@ -31,7 +31,30 @@ jobs: SHELLOPTS: "errexit:pipefail" steps: - name: "Install Git and checkout project" - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.2 + + - name: "Login in Github container registry" + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ secrets.GH_USERNAME }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: "DPF server activation" + run: | + $(docker pull ghcr.io/ansys/dpf-core:22.2dev && docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}.") & + + - name: "Pull, launch, and validate MAPDL service" + id: start_mapdl + env: + LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} + MAPDL_VERSION: ${{ env.MAPDL_IMAGE_VERSION_DOCS_BUILD }} + DISTRIBUTED_MODE: "dmp" + run: | + export INSTANCE_NAME=MAPDL + .ci/start_mapdl.sh &> mapdl_launch.log & export DOCKER_PID=$! + echo "Launching MAPDL service at PID: $DOCKER_PID" + echo "DOCKER_PID=$(echo $DOCKER_PID)" >> $GITHUB_OUTPUT - name: "Setup Python" uses: actions/setup-python@v5 @@ -53,19 +76,6 @@ jobs: pip install . xvfb-run python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())" - - name: "Login in Github container registry" - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ secrets.GH_USERNAME }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: "Pull, launch, and validate MAPDL service" - run: .ci/start_mapdl.sh - env: - LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} - MAPDL_IMAGE: '${{ env.DOCKER_PACKAGE }}:${{ env.DOCKER_IMAGE_VERSION_DOCS_BUILD }}' - - name: "Retrieve PyMAPDL version" id: version run: | @@ -76,10 +86,9 @@ jobs: run: | pip install .[doc] - - name: "DPF server activation" + - name: "Waiting for the services to be up" run: | - docker pull ghcr.io/ansys/dpf-core:22.2dev - docker run -d --name dpfserver -p ${{ env.DPF_PORT }}:50052 ghcr.io/ansys/dpf-core:22.2dev && echo "DPF Server active on port ${{ env.DPF_PORT }}." + .ci/waiting_services.sh - name: LinkCheck run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba14650f4b..4aabf704e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: - id: isort - repo: https://github.com/numpy/numpydoc - rev: v1.6.0 + rev: v1.7.0 hooks: - id: numpydoc-validation exclude: | @@ -26,7 +26,7 @@ repos: ) - repo: https://github.com/psf/black - rev: 24.2.0 # If version changes --> modify "blacken-docs" manually as well. + rev: 24.3.0 # If version changes --> modify "blacken-docs" manually as well. hooks: - id: black args: @@ -36,7 +36,7 @@ repos: rev: 1.16.0 hooks: - id: blacken-docs - additional_dependencies: [black==24.2.0] + additional_dependencies: [black==24.3.0] - repo: https://github.com/PyCQA/flake8 rev: 7.0.0 @@ -65,6 +65,6 @@ repos: # this validates our github workflow files - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.0 + rev: 0.28.1 hooks: - id: check-github-workflows diff --git a/README.md b/README.md index 2e3a85504a..fc16cc054d 100644 --- a/README.md +++ b/README.md @@ -108,14 +108,13 @@ correct citation. For example, the BibTex citation is: ```bibtex @software{alexander_kaszynski_2020_4009467, author = {Alexander Kaszynski}, - title = {{pyansys: Python Interface to MAPDL and Associated - Binary and ASCII Files}}, - month = aug, - year = 2020, + title = {{pyansys: Pythonic interface to MAPDL}}, + month = nov, + year = 2021, publisher = {Zenodo}, - version = {0.43.2}, - doi = {10.5281/zenodo.4009467}, - url = {https://doi.org/10.5281/zenodo.4009467} + version = {0.60.3}, + doi = {10.5281/zenodo.4009466}, + url = {https://doi.org/10.5281/zenodo.4009466} } ``` diff --git a/doc/source/api/pool.rst b/doc/source/api/pool.rst index 583b85a6ab..b9134852d7 100644 --- a/doc/source/api/pool.rst +++ b/doc/source/api/pool.rst @@ -8,4 +8,4 @@ Local MAPDL pool .. autosummary:: :toctree: _autosummary - pool.LocalMapdlPool + pool.MapdlPool diff --git a/doc/source/conf.py b/doc/source/conf.py index 9c0d1e3481..010b96c92e 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -4,7 +4,12 @@ import os import warnings -from ansys_sphinx_theme import ansys_favicon, get_version_match, pyansys_logo_white +from ansys_sphinx_theme import ( + ansys_favicon, + get_version_match, + pyansys_logo_black, + pyansys_logo_white, +) import numpy as np import pyvista from sphinx.application import Sphinx @@ -45,7 +50,7 @@ # -- Project information ----------------------------------------------------- -project = "ansys.mapdl.core" +project = "ansys-mapdl-core" copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved" author = "ANSYS Inc." @@ -83,7 +88,6 @@ "sphinx.ext.graphviz", "sphinx_reredirects", "ansys_sphinx_theme.extension.linkcode", - "sphinx_design", ] # Intersphinx mapping @@ -138,6 +142,7 @@ # notfound.extension notfound_template = "404.rst" notfound_urls_prefix = "/../" +html_baseurl = f"https://{cname}/version/stable" # static path html_static_path = ["_static"] @@ -208,6 +213,8 @@ "https://mapdl.docs.pyansys.com/*", "https://ansysaccount.b2clogin.com/*", # behind payfirewall "https://ansyshelp.ansys.com/*", # behind payfirewall + "https://forum.ansys.com/forums/*", # It is detected as broken + "https://courses.ansys.com/*", # It is detected as broken ] linkcheck_anchors_ignore = [ # these anchors are picked by linkcheck as broken but they are not. @@ -259,7 +266,7 @@ # -- Options for HTML output ------------------------------------------------- html_short_title = html_title = "PyMAPDL" html_theme = "ansys_sphinx_theme" -html_logo = "./_static/pyansys-logo-black-cropped.png" # pyansys_logo_black +html_logo = pyansys_logo_black html_theme_options = { "analytics": {"google_analytics_id": "G-JQJKPV6ZVB"}, "github_url": f"https://github.com/{USERNAME}/{REPOSITORY_NAME}", diff --git a/doc/source/getting_started/devcontainer.rst b/doc/source/getting_started/devcontainer.rst index 0ad57f4b83..0c5e8d416e 100644 --- a/doc/source/getting_started/devcontainer.rst +++ b/doc/source/getting_started/devcontainer.rst @@ -34,19 +34,26 @@ container, you are prompt to enter your license server port and address. You can set the :envvar:`ANSYSLMD_LICENSE_FILE` environment variable from the terminal before launching VS Code. For example, if you have a license server at the address ``123.45.67.89``, -you can set the license on Windows using: +you can set the license using: -.. code:: pwsh-session - - $env:ANSYSLMD_LICENSE_FILE = '1055@123.45.65.89' - code . # launch VS Code +.. tab-set:: -On Linux + .. tab-item:: Windows + :sync: key1 -.. code:: bash + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> $env:ANSYSLMD_LICENSE_FILE = '1055@123.45.65.89' + (.venv) PS C:\Users\user\pymapdl> code . # launch VS Code + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ export ANSYSLMD_LICENSE_FILE =1055@123.45.65.89 + (.venv) user@machine:~$code . # launch VS Code - $ export ANSYSLMD_LICENSE_FILE =1055@123.45.65.89 - code . # launch VS Code And then open the folder in the container using the `Command palette`. diff --git a/doc/source/getting_started/develop_pymapdl.rst b/doc/source/getting_started/develop_pymapdl.rst index b7ca1cfdb9..130b2e9966 100644 --- a/doc/source/getting_started/develop_pymapdl.rst +++ b/doc/source/getting_started/develop_pymapdl.rst @@ -195,21 +195,26 @@ It is executed upstream of each test and not within all tests. If you do not have MAPDL installed locally but still want to run the unit testing, you must set up the following environment variables. -In Windows, use this code: +.. tab-set:: -.. code:: pwsh-session + .. tab-item:: Windows + :sync: key1 - SET PYMAPDL_START_INSTANCE=False - SET PYMAPDL_PORT= (default 50052) - SET PYMAPDL_IP= (default 127.0.0.1) + .. code:: pwsh-session -In Linux, use this code: + SET PYMAPDL_START_INSTANCE=False + SET PYMAPDL_PORT= (default 50052) + SET PYMAPDL_IP= (default 127.0.0.1) -.. code:: console + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + export PYMAPDL_START_INSTANCE=False + export PYMAPDL_PORT= (default 50052) + export PYMAPDL_IP= (default 127.0.0.1) - export PYMAPDL_START_INSTANCE=False - export PYMAPDL_PORT= (default 50052) - export PYMAPDL_IP= (default 127.0.0.1) These environment variables tell PyMAPDL to attempt to connect to the existing MAPDL service by default when the ``launch_mapdl`` function is used. diff --git a/doc/source/getting_started/docker.rst b/doc/source/getting_started/docker.rst index e892b3268f..93cf6ab703 100644 --- a/doc/source/getting_started/docker.rst +++ b/doc/source/getting_started/docker.rst @@ -85,25 +85,28 @@ container. To instantiate an MAPDL Docker container from an image hosted at ``ghcr.io/myuser/myrepo/mymapdldockerimage``, use code like in the following examples. -**On Windows** +.. tab-set:: -.. code:: pwsh-session + .. tab-item:: Windows + :sync: key1 - $env:ANSYSLMD_LICENSE_FILE="1055@MY_LICENSE_SERVER_IP" - $env:LOCAL_MAPDL_PORT=50053 - $env:MAPDL_DOCKER_REGISTRY_URL="ghcr.io/myuser/myrepo/mymapdldockerimage" + .. code:: pwsh-session - docker run -e ANSYSLMD_LICENSE_FILE=$env:ANSYSLMD_LICENSE_FILE --restart always --name mapdl -p $env:LOCAL_MAPDL_PORT`:50052 $env:MAPDL_DOCKER_REGISTRY_URL -smp + $env:ANSYSLMD_LICENSE_FILE="1055@MY_LICENSE_SERVER_IP" + $env:LOCAL_MAPDL_PORT=50053 + $env:MAPDL_DOCKER_REGISTRY_URL="ghcr.io/myuser/myrepo/mymapdldockerimage" + docker run -e ANSYSLMD_LICENSE_FILE=$env:ANSYSLMD_LICENSE_FILE --restart always --name mapdl -p $env:LOCAL_MAPDL_PORT`:50052 $env:MAPDL_DOCKER_REGISTRY_URL -smp -**On Linux** + .. tab-item:: Linux + :sync: key1 -.. code:: bash + .. code:: bash - ANSYSLMD_LICENSE_FILE=1055@MY_LICENSE_SERVER_IP - LOCAL_MAPDL_PORT=50053 - MAPDL_DOCKER_REGISTRY_URL=ghcr.io/myuser/myrepo/mymapdldockerimage - docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp > log.txt + ANSYSLMD_LICENSE_FILE=1055@MY_LICENSE_SERVER_IP + LOCAL_MAPDL_PORT=50053 + MAPDL_DOCKER_REGISTRY_URL=ghcr.io/myuser/myrepo/mymapdldockerimage + docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp > log.txt The first time you instantiate the container, Docker logins into the registry and @@ -111,17 +114,42 @@ pulls the required image. This can take some time, depending on the size of the To rerun it, you should restart the container with this command: -.. code:: bash - docker start mapdl +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker start mapdl + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker start mapdl Or you can delete the container and run it again using these commands: -.. code:: bash +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker rm -f mapdl + (.venv) PS C:\Users\user\pymapdl> docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp > log.txt - docker rm -f mapdl + .. tab-item:: Linux + :sync: key1 + + .. code:: console - docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp > log.txt + (.venv) user@machine:~$ docker rm -f mapdl + (.venv) user@machine:~$ docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp > log.txt You can append the Docker flag ``--rm`` to automatically clean up the container @@ -157,10 +185,22 @@ appending them to the end of the command. For example, you can increase the number of processors (up to the number available on the host machine) with the ``-np`` switch: -.. code:: bash - docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always -d --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp -np 8 > log.txt +.. tab-set:: + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always -d --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp -np 8 | Out-File -FilePath .\log.txt + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker run -e ANSYSLMD_LICENSE_FILE=$ANSYSLMD_LICENSE_FILE --restart always -d --name mapdl -p $LOCAL_MAPDL_PORT:50052 $MAPDL_DOCKER_REGISTRY_URL -smp -np 8 > log.txt For additional command line arguments, see the *Notes* section in the description for the :func:`launch_mapdl() ` @@ -172,7 +212,7 @@ to run the preceding commands all at once. Once you have launched MAPDL, you should see the following content in your console (or the output file): -.. code:: +.. code:: text Start GRPC Server @@ -249,14 +289,32 @@ the process with the ``ANSYS_LOCK`` environment variable set to ``"OFF"``. This code shows how to do this in your `docker run `_ command: -.. code:: bash - docker run \ - --restart always \ - -e ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER \ - -e ANSYS_LOCK="OFF" \ - -p 50052:50052 \ - $IMAGE +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker run ` + --restart always ` + -e ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER ` + -e ANSYS_LOCK="OFF" ` + -p 50052:50052 ` + $IMAGE + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker run \ + --restart always \ + -e ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER \ + -e ANSYS_LOCK="OFF" \ + -p 50052:50052 \ + $IMAGE Get useful files after abnormal termination @@ -268,75 +326,205 @@ tools that Docker provides. First, get the Docker container name: -.. code:: pwsh-session - PS docker ps -a - CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES - c14560bff70f my.registry/myuser/mypackage/mapdl "/ansys_inc/ansys/bi…" 9 seconds ago Exited(137) 0.0.0.0:50053->50052/tcp mapdl +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + c14560bff70f my.registry/myuser/mypackage/mapdl "/ansys_inc/ansys/bi…" 9 seconds ago Exited(137) 0.0.0.0:50053->50052/tcp mapdl + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + c14560bff70f my.registry/myuser/mypackage/mapdl "/ansys_inc/ansys/bi…" 9 seconds ago Exited(137) 0.0.0.0:50053->50052/tcp mapdl Then use the ``name`` in this command: -.. code:: pwsh-session - PS docker exec -it mapdl /bin/bash +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker exec -it mapdl /bin/bash + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker exec -it mapdl /bin/bash This command executes the command shell (``/bin/bash``) of the container and attaches your current terminal to it (interactive ``-it``). -.. code:: pwsh-session - PS C:\Users\user> docker exec -it mapdl /bin/bash - [root@c14560bff70f /]# +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker exec -it mapdl /bin/bash + [root@c14560bff70f /]# + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker exec -it mapdl /bin/bash + [root@c14560bff70f /]# Now you can enter commands inside the Docker container and navigate inside it. -.. code:: pwsh-session +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker exec -it mapdl /bin/bash + [root@c14560bff70f /]# ls + anaconda-post.log cleanup-ansys-c14560bff70f-709.sh file0.err file1.err file1.page file2.out file3.log home media proc sbin tmp + ansys_inc dev file0.log file1.log file2.err file2.page file3.out lib mnt root srv usr + bin etc file0.page file1.out file2.log file3.err file3.page lib64 opt run sys var + + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker exec -it mapdl /bin/bash + [root@c14560bff70f /]# ls + anaconda-post.log cleanup-ansys-c14560bff70f-709.sh file0.err file1.err file1.page file2.out file3.log home media proc sbin tmp + ansys_inc dev file0.log file1.log file2.err file2.page file3.out lib mnt root srv usr + bin etc file0.page file1.out file2.log file3.err file3.page lib64 opt run sys var - PS C:\Users\user> docker exec -it mapdl /bin/bash - [root@c14560bff70f /]# ls - anaconda-post.log cleanup-ansys-c14560bff70f-709.sh file0.err file1.err file1.page file2.out file3.log home media proc sbin tmp - ansys_inc dev file0.log file1.log file2.err file2.page file3.out lib mnt root srv usr - bin etc file0.page file1.out file2.log file3.err file3.page lib64 opt run sys var You can then take note of the files you want to retrieve. For example, you would likely want to retrieve the error and output files (``file*.err`` and ``file*.out``). Exit the container terminal using the ``exit`` command: -.. code:: pwsh-session +.. tab-set:: - [root@c14560bff70f /]# exit - exit - (base) PS C:\Users\user> + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + [root@c14560bff70f /]# exit + exit + (.venv) PS C:\Users\user\pymapdl> + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + [root@c14560bff70f /]# exit + exit + (.venv) user@machine:~$ You can then copy the noted files using the `docker cp `_ command: -.. code:: pwsh-session +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker cp mapdl:/file0.err . - docker cp mapdl:/file0.err . + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker cp mapdl:/file0.err . This command copies the files in the current directory. You can specify a different destination using the second argument. If you want to retrieve multiple files, the most efficient approach is to get back inside the Docker container: -.. code:: pwsh-session - PS C:\Users\user> docker exec -it mapdl /bin/bash - [root@c14560bff70f /]# +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker exec -it mapdl /bin/bash + [root@c14560bff70f /]# + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ docker exec -it mapdl /bin/bash + [root@c14560bff70f /]# Create a folder where you are going to copy all the desired files: -.. code:: pwsh-session - [root@c14560bff70f /]# mkdir -p /mapdl_logs - [root@c14560bff70f /]# cp -f /file*.out /mapdl_logs - [root@c14560bff70f /]# cp -f /file*.err /mapdl_logs - [root@c14560bff70f /]# ls mapdl_logs/ - file0.err file1.err file1.out file2.err file2.out file3.err file3.out +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> + [root@c14560bff70f /]# mkdir -p /mapdl_logs + [root@c14560bff70f /]# cp -f /file*.out /mapdl_logs + [root@c14560bff70f /]# cp -f /file*.err /mapdl_logs + [root@c14560bff70f /]# ls mapdl_logs/ + file0.err file1.err file1.out file2.err file2.out file3.err file3.out + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ + [root@c14560bff70f /]# mkdir -p /mapdl_logs + [root@c14560bff70f /]# cp -f /file*.out /mapdl_logs + [root@c14560bff70f /]# cp -f /file*.err /mapdl_logs + [root@c14560bff70f /]# ls mapdl_logs/ + file0.err file1.err file1.out file2.err file2.out file3.err file3.out + Then copy the entire folder content at once: -.. code:: pwsh-session +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> docker cp mapdl:/mapdl_logs/. . - docker cp mapdl:/mapdl_logs/. . + .. tab-item:: Linux + :sync: key1 + + .. code:: console + (.venv) user@machine:~$ docker cp mapdl:/mapdl_logs/. . diff --git a/doc/source/getting_started/install_pymapdl.rst b/doc/source/getting_started/install_pymapdl.rst index d0b6034e55..baa49d5e25 100644 --- a/doc/source/getting_started/install_pymapdl.rst +++ b/doc/source/getting_started/install_pymapdl.rst @@ -8,10 +8,10 @@ Install PyMAPDL Python module ~~~~~~~~~~~~~ -The ``ansys.mapdl.core`` package currently supports Python 3.8 through -Python 3.11 on Windows, Mac OS, and Linux. +The ``ansys.mapdl.core`` package currently supports Python 3.9 through +Python 3.12 on Windows, Mac OS, and Linux. -Install the latest release from `PyPi `_ with: +Install the latest release from `PyPi `_ with this command: .. code:: console diff --git a/doc/source/getting_started/launcher.rst b/doc/source/getting_started/launcher.rst index 5b0c92f69c..fad52730b1 100644 --- a/doc/source/getting_started/launcher.rst +++ b/doc/source/getting_started/launcher.rst @@ -55,19 +55,27 @@ Launch a local gRPC MAPDL session You can start MAPDL from the command line and then connect to it. -To launch MAPDL on Windows (assuming that Ansys is installed in the -:file:`C:/Program Files/ANSYS Inc/v241` directory), use this command: +To launch MAPDL, use this command: -.. code:: pwsh-session +.. tab-set:: - C:/Program Files/ANSYS Inc/v241/ansys/bin/winx64/ANSYS211.exe -grpc + .. tab-item:: Windows + :sync: key1 -To launch MAPDL on Linux (assuming that Ansys is installed in the -:file:`/usr/ansys_inc` directory), use this command: + .. code:: pwsh-session -.. code:: console + (.venv) PS C:\Users\user\pymapdl> C:/Program Files/ANSYS Inc/v241/ansys/bin/winx64/ANSYS211.exe -grpc - /usr/ansys_inc/v241/ansys/bin/ansys211 -grpc + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ /usr/ansys_inc/v241/ansys/bin/ansys211 -grpc + +When launching MAPDL on Windows, it is assumed that Ansys is installed in the +:file:`C:/Program Files/ANSYS Inc/v241` directory and, on Linux, it is assumed +that Ansys is installed in the :file:`/usr/ansys_inc` directory. This starts MAPDL in gRPC mode. MAPDL should display this output: @@ -86,9 +94,22 @@ You can configure the port that MAPDL starts on with the ``-port`` argument. For example, you can start the server to listen for connections at port 50005 with this command: -.. code:: console +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> C:/Program Files/ANSYS Inc/v241/ansys/bin/winx64/ANSYS211.exe -port 50005 -grpc + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ /usr/ansys_inc/v241/ansys/bin/ansys211 -port 50005 -grpc - /usr/ansys_inc/v241/ansys/bin/ansys211 -port 50005 -grpc From version v0.68, you can use a command line interface to launch, stop, and list local MAPDL instances. @@ -199,7 +220,7 @@ to enter the path again. If you must change the default Ansys path from ansys.mapdl import core as pymapdl - new_path = "C:\\Program Files\\ANSYS Inc\\v212\\ANSYS\\bin\\winx64\\ansys222.exe" + new_path = "C:\\Program Files\\ANSYS Inc\\v241\\ANSYS\\bin\\winx64\\ansys222.exe" pymapdl.change_default_ansys_path(new_path) For more information, see the :func:`change_default_ansys_path() ` method and the :func:`find_ansys() ` method. @@ -207,32 +228,55 @@ For more information, see the :func:`change_default_ansys_path() doc\make.bat html -.. code:: pwsh-session + .. tab-item:: Linux + :sync: key1 + + .. code:: console - doc\make.bat html + (.venv) user@machine:~$ make -C doc html + The HTML files for the documentation are written to the ``doc/_build/html`` directory. If you want to build the PDF documentation, you must first install a LaTeX distribution like `MikTeX `_. You can then run this command: -.. code:: console +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> doc\make.bat pdf + + .. tab-item:: Linux + :sync: key1 + + .. code:: console - make -C doc pdf + (.venv) user@machine:~$ make -C doc pdf Running the command to build either HTML files or a PDF file runs the Python files in ``./examples`` in the repository root directory to generate the `examples gallery `_. The result of running these examples is cached so that the only the changed files diff --git a/doc/source/user_guide/cli.rst b/doc/source/user_guide/cli.rst index 83b63a683a..f780f3b959 100644 --- a/doc/source/user_guide/cli.rst +++ b/doc/source/user_guide/cli.rst @@ -22,7 +22,7 @@ To start MAPDL, just type on your activated virtual environment: .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl + (.venv) PS C:\Users\user\pymapdl> pymapdl start Success: Launched an MAPDL instance (PID=23644) at 127.0.0.1:50052 .. tab-item:: Linux @@ -30,7 +30,7 @@ To start MAPDL, just type on your activated virtual environment: .. code:: console - (.venv) user@machine:~$ launch_mapdl + (.venv) user@machine:~$ pymapdl start Success: Launched an MAPDL instance (PID=23644) at 127.0.0.1:50052 If you want to specify an argument, for instance the port, then you need to call @@ -44,7 +44,7 @@ If you want to specify an argument, for instance the port, then you need to call .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl start --port 50054 + (.venv) PS C:\Users\user\pymapdl> pymapdl start --port 50054 Success: Launched an MAPDL instance (PID=18238) at 127.0.0.1:50054 .. tab-item:: Linux @@ -52,14 +52,14 @@ If you want to specify an argument, for instance the port, then you need to call .. code:: console - (.venv) user@machine:~$ launch_mapdl start --port 50054 + (.venv) user@machine:~$ pymapdl start --port 50054 Success: Launched an MAPDL instance (PID=18238) at 127.0.0.1:50054 -This command `launch_mapdl start` aims to replicate the function -:func:`ansys.mapdl.core.launcher.launch_mapdl`, hence you can use +This ``pymapdl start`` command aims to replicate the function +:func:`ansys.mapdl.core.launcher.launch_mapdl`. Hence, you can use some of the arguments which this function allows. -For instance, you could specify the working directory: +For instance, you could specify the working directory: .. tab-set:: @@ -68,7 +68,7 @@ For instance, you could specify the working directory: .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl start --run_location C:\Users\user\temp\ + (.venv) PS C:\Users\user\pymapdl> pymapdl start --run_location C:\Users\user\temp\ Success: Launched an MAPDL instance (PID=32612) at 127.0.0.1:50052 .. tab-item:: Linux @@ -76,18 +76,16 @@ For instance, you could specify the working directory: .. code:: console - (.venv) user@machine:~$ launch_mapdl start --run_location /home/user/tmp + (.venv) user@machine:~$ pymapdl start --run_location /home/user/tmp Success: Launched an MAPDL instance (PID=32612) at 127.0.0.1:50052 -For more information see :func:`ansys.mapdl.core.launcher.launch_mapdl`, -and :func:`ansys.mapdl.core.cli.launch_mapdl` +For more information, see :func:`ansys.mapdl.core.launcher.launch_mapdl`. Stop MAPDL instances ==================== -MAPDL instances can be stopped by using `launch_mapdl stop` command in the following -way: +You can use the ``pymapdl stop`` command to stop MAPDL instances like this: .. tab-set:: @@ -97,7 +95,7 @@ way: .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl stop + (.venv) PS C:\Users\user\pymapdl> pymapdl stop Success: Ansys instances running on port 50052 have been stopped. .. tab-item:: Linux @@ -105,7 +103,7 @@ way: .. code:: console - (.venv) user@machine:~$ launch_mapdl stop + (.venv) user@machine:~$ pymapdl stop Success: Ansys instances running on port 50052 have been stopped. @@ -121,7 +119,7 @@ You can specify the instance running on a different port using `--port` argument .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl stop --port 50053 + (.venv) PS C:\Users\user\pymapdl> pymapdl stop --port 50053 Success: Ansys instances running on port 50053 have been stopped. .. tab-item:: Linux @@ -129,7 +127,7 @@ You can specify the instance running on a different port using `--port` argument .. code:: console - (.venv) user@machine:~$ launch_mapdl stop --port 50053 + (.venv) user@machine:~$ pymapdl stop --port 50053 Success: Ansys instances running on port 50053 have been stopped. @@ -143,7 +141,7 @@ Or an instance with a given process id (PID): .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl stop --pid 40952 + (.venv) PS C:\Users\user\pymapdl> pymapdl stop --pid 40952 Success: The process with PID 40952 and its children have been stopped. .. tab-item:: Linux @@ -151,8 +149,8 @@ Or an instance with a given process id (PID): .. code:: console - (.venv) user@machine:~$ launch_mapdl stop --pid 40952 - Success: The process with PID 40952 and its children have been stopped. + (.venv) user@machine:~$ pymapdl stop --pid 40952 + Success: The process with PID 40952 and its children has been stopped. Alternatively, you can stop all the running instances by using: @@ -165,7 +163,7 @@ Alternatively, you can stop all the running instances by using: .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl stop --all + (.venv) PS C:\Users\user\pymapdl> pymapdl stop --all Success: Ansys instances have been stopped. .. tab-item:: Linux @@ -173,7 +171,7 @@ Alternatively, you can stop all the running instances by using: .. code:: console - (.venv) user@machine:~$ launch_mapdl stop --all + (.venv) user@machine:~$ pymapdl stop --all Success: Ansys instances have been stopped. @@ -191,7 +189,7 @@ If you want to list MAPDL process, just use the following command: .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl list + (.venv) PS C:\Users\user\pymapdl> pymapdl list Name Is Instance Status gRPC port PID ------------ ------------- -------- ----------- ----- ANSYS.exe False running 50052 35360 @@ -203,7 +201,7 @@ If you want to list MAPDL process, just use the following command: .. code:: console - (.venv) user@machine:~$ launch_mapdl list + (.venv) user@machine:~$ pymapdl list Name Is Instance Status gRPC port PID ------------ ------------- -------- ----------- ----- ANSYS.exe False running 50052 35360 @@ -222,7 +220,7 @@ processes), just type: .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl list -i + (.venv) PS C:\Users\user\pymapdl> pymapdl list -i Name Status gRPC port PID ------------ -------- ----------- ----- ANSYS222.exe running 50052 41644 @@ -232,7 +230,7 @@ processes), just type: .. code:: console - (.venv) user@machine:~$ launch_mapdl list -i + (.venv) user@machine:~$ pymapdl list -i Name Status gRPC port PID ------------ -------- ----------- ----- ANSYS222.exe running 50052 41644 @@ -251,7 +249,7 @@ argument `--long` or `-l`: .. code:: pwsh-session - (.venv) PS C:\Users\user\pymapdl> launch_mapdl list -l + (.venv) PS C:\Users\user\pymapdl> pymapdl list -l Name Is Instance Status gRPC port PID Command line Working directory ------------ ------------- -------- ----------- ----- -------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------- ANSYS.exe False running 50052 35360 C:\Program Files\ANSYS Inc\v222\ANSYS\bin\winx64\ANSYS.EXE -j file -b -i .__tmp__.inp -o .__tmp__.out -port 50052 -grpc C:\Users\User\AppData\Local\Temp\ansys_ahmfaliakp @@ -263,7 +261,7 @@ argument `--long` or `-l`: .. code:: console - (.venv) user@machine:~$ launch_mapdl list -l + (.venv) user@machine:~$ pymapdl list -l Name Is Instance Status gRPC port PID Command line Working directory ------------ ------------- -------- ----------- ----- ------------------------------------------------------------------------- -------------------------------- ANSYS False running 50052 35360 /ansys_inc/v222/ansys/bin/linx64/ansys -j file -port 50052 -grpc /home/user/temp/ansys_ahmfaliakp @@ -286,25 +284,64 @@ After you have activated and installed the package as described in :ref:`installation`, you can use the converter from your terminal. Here is how you use the ``pymapdl convert`` command: -.. code:: console - $ pymapdl convert mapdl.dat -o python.py +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> pymapdl convert mapdl.dat -o python.py + + The ``mapdl.dat`` file is successfully converted to the ``python.py`` file. - File mapdl.dat successfully converted to python.py. + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ pymapdl convert mapdl.dat -o python.py + + File mapdl.dat successfully converted to python.py. To obtain help on converter usage, options, and examples, type this command: -.. code:: console - $ pymapdl convert --help +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> pymapdl convert --help + + + Usage: pymapdl convert [OPTIONS] FILENAME_IN + + PyMAPDL CLI tool for converting MAPDL scripts to PyMAPDL scripts. + + USAGE: + + ... + + + .. tab-item:: Linux + :sync: key1 + + .. code:: console - Usage: pymapdl convert [OPTIONS] FILENAME_IN + (.venv) user@machine:~$ pymapdl convert --help + + Usage: pymapdl convert [OPTIONS] FILENAME_IN - PyMAPDL CLI tool for converting MAPDL scripts to PyMAPDL scripts. + PyMAPDL CLI tool for converting MAPDL scripts to PyMAPDL scripts. - USAGE: + USAGE: - ... + ... The ``pymapdl convert`` command uses the diff --git a/doc/source/user_guide/pool.rst b/doc/source/user_guide/pool.rst index d8e045acca..e520ba1b3c 100644 --- a/doc/source/user_guide/pool.rst +++ b/doc/source/user_guide/pool.rst @@ -3,7 +3,7 @@ Create a pool of MAPDL instances ================================ -PyMAPDL contains the :class:`LocalMapdlPool ` +PyMAPDL contains the :class:`MapdlPool ` class to simplify creating multiple local instances of the :class:`Mapdl ` class for batch processing. This can be used for the batch processing of a @@ -14,8 +14,8 @@ This code creates a pool: .. code:: pycon - >>> from ansys.mapdl.core import LocalMapdlPool - >>> pool = LocalMapdlPool(10) + >>> from ansys.mapdl.core import MapdlPool + >>> pool = MapdlPool(10) 'MAPDL Pool with 10 active instances' >>> pool.exit(block=True) @@ -27,7 +27,7 @@ at the current directory within their own isolated directories: >>> import os >>> my_path = os.getcmd() - >>> pool = LocalMapdlPool(10, nproc=1, run_location=my_path) + >>> pool = MapdlPool(10, nproc=1, run_location=my_path) Creating Pool: 100%|########| 10/10 [00:01<00:00, 1.43it/s] You can access each individual MAPDL instance with this code: @@ -46,7 +46,7 @@ Run a set of input files ------------------------ You can use the pool to run a set of pre-generated input files using the -:func:`run_batch ` method. For +:func:`run_batch ` method. For example, this code would run the first set of 20 verification files: .. code:: pycon @@ -63,7 +63,7 @@ Run a user function You can use the pool to run a custom user function on each MAPDL instance over a set of inputs. As in the example for the -:func:`run_batch ` function, +:func:`run_batch ` function, the following code uses a set of verification files. However, it implements it as a function and outputs the final routine instead of the text output from MAPDL. @@ -103,7 +103,7 @@ Close the PyMAPDL pool ---------------------- You can close the PyMAPDL pool with the -:meth:`pool.exit() ` command. +:meth:`pool.exit() ` command. .. code:: pycon diff --git a/doc/source/user_guide/troubleshoot.rst b/doc/source/user_guide/troubleshoot.rst index 38315fc3e9..4136086ec8 100644 --- a/doc/source/user_guide/troubleshoot.rst +++ b/doc/source/user_guide/troubleshoot.rst @@ -91,56 +91,101 @@ Testing MAPDL launching In some cases, it may be necessary to run the launch command manually from the command line. -**On Windows** -Open up a command prompt and run the version-dependent command: +.. tab-set:: -.. code:: pwsh-session + .. tab-item:: Windows + :sync: key1 - "C:\Program Files\ANSYS Inc\v211\ansys\bin\winx64\ANSYS211.exe" + Open up a command prompt and run the version-dependent command: -.. note:: PowerShell users can run the preceding command without quotes. + .. code:: pwsh-session + (.venv) PS C:\Users\user\pymapdl> "C:\Program Files\ANSYS Inc\v241\ansys\bin\winx64\ANSYS241.exe" + + .. note:: PowerShell users can run the preceding command without quotes. -**On Linux** + .. tab-item:: Linux + :sync: key1 + + Run the version-dependent command: -Run the version-dependent command: + .. code:: console -.. code:: console + (.venv) user@machine:~$ /usr/ansys_inc/v241/ansys/bin/ansys241 - /usr/ansys_inc/v211/ansys/bin/ansys211 You should start MAPDL in a temporary working directory because MAPDL creates several temporary files. You can specify a directory by launching MAPDL from the temporary directory: -.. code:: pwsh-session - mkdir temporary_directory - cd temporary_directory - & 'C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ANSYS222.exe' +.. tab-set:: -Or, you can specify the directory using the ``-dir`` flag: + .. tab-item:: Windows + :sync: key1 -.. code:: pwsh-session + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> mkdir temporary_directory + (.venv) PS C:\Users\user\pymapdl> cd temporary_directory + (.venv) PS C:\Users\user\pymapdl> & 'C:\Program Files\ANSYS Inc\v241\ansys\bin\winx64\ANSYS241.exe' + + Or, you can specify the directory using the ``-dir`` flag: + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> mkdir temporary_directory + (.venv) PS C:\Users\user\pymapdl> & 'C:\Program Files\ANSYS Inc\v241\ansys\bin\winx64\ANSYS241.exe' -dir "C:\ansys_job\mytest1" + + + .. tab-item:: Linux + :sync: key1 + + .. code:: console + + (.venv) user@machine:~$ mkdir temporary_directory + (.venv) user@machine:~$ cd temporary_directory + (.venv) user@machine: temporary_directory $ /usr/ansys_inc/v241/ansys/bin/ansys241 + + Or, you can specify the directory using the ``-dir`` flag: - mkdir temporary_directory - & 'C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ANSYS222.exe' -dir "C:\ansys_job\mytest1" + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> mkdir /tmp/ansys_tmp/job1 + (.venv) PS C:\Users\user\pymapdl> /usr/ansys_inc/v241/ansys/bin/ansys241 -dir /tmp/ansys_tmp/job1 If this command doesn't launch MAPDL, look at the command output: .. vale off -.. code:: pwsh-session +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> & 'C:\Program Files\ANSYS Inc\v241\ansys\bin\winx64\ANSYS241.exe' + *** ERROR *** + Another Ansys job with the same job name (file) is already running in this + directory or the file.lock file has not been deleted from an abnormally + terminated Ansys run. To disable this check, set the ANSYS_LOCK environment + variable to OFF. + + .. tab-item:: Linux + :sync: key1 + + .. code:: console - (base) PS C:\Users\user\temp> & 'C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ANSYS222.exe' - *** ERROR *** - Another Ansys job with the same job name (file) is already running in this - directory or the file.lock file has not been deleted from an abnormally - terminated Ansys run. To disable this check, set the ANSYS_LOCK environment - variable to OFF. + (.venv) user@machine:~$ /usr/ansys_inc/v241/ansys/bin/ansys241 + *** ERROR *** + Another Ansys job with the same job name (file) is already running in this + directory or the file.lock file has not been deleted from an abnormally + terminated Ansys run. To disable this check, set the ANSYS_LOCK environment + variable to OFF. .. vale on @@ -150,22 +195,47 @@ Licensing issues Incorrect license server configuration can prevent MAPDL from being able to get a valid license. In such cases, you might see output **similar** to: -.. code:: pwsh-session - (base) PS C:\Users\user\temp> & 'C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ANSYS222.exe' +.. tab-set:: + + .. tab-item:: Windows + :sync: key1 + + .. code:: pwsh-session + + (.venv) PS C:\Users\user\pymapdl> & 'C:\Program Files\ANSYS Inc\v241\ansys\bin\winx64\ANSYS241.exe' + + ANSYS LICENSE MANAGER ERROR: + + Maximum licensed number of demo users already reached. - ANSYS LICENSE MANAGER ERROR: - Maximum licensed number of demo users already reached. + ANSYS LICENSE MANAGER ERROR: + Request name mech_2 does not exist in the licensing pool. + No such feature exists. + Feature: mech_2 + License path: C:\Users\user\AppData\Local\Temp\\cb0400ba-6edb-4bb9-a333-41e7318c007d; + FlexNet Licensing error:-5,357 - ANSYS LICENSE MANAGER ERROR: + .. tab-item:: Linux + :sync: key1 + + .. code:: console - Request name mech_2 does not exist in the licensing pool. - No such feature exists. - Feature: mech_2 - License path: C:\Users\user\AppData\Local\Temp\\cb0400ba-6edb-4bb9-a333-41e7318c007d; - FlexNet Licensing error:-5,357 + (.venv) user@machine:~$ /usr/ansys_inc/v241/ansys/bin/ansys241 + + ANSYS LICENSE MANAGER ERROR: + + Maximum licensed number of demo users already reached. + + + ANSYS LICENSE MANAGER ERROR: + + Request name mech_2 does not exist in the licensing pool. + No such feature exists. + Feature: mech_2 + FlexNet Licensing error:-5,357 PADT has a great blog regarding ANSYS issues, and licensing is always a common issue. For @@ -182,20 +252,24 @@ The license server can be also specified using the environment variable :envvar: The following code examples show how you can see the value of this environment variable on either Windows or Linux. -**On Windows** - -.. code:: pwsh-session +.. tab-set:: - $env:ANSYSLMD_LICENSE_FILE - 1055@1.1.1.1 + .. tab-item:: Windows + :sync: key1 + .. code:: pwsh-session -**On Linux** + (.venv) PS C:\Users\user\pymapdl> $env:ANSYSLMD_LICENSE_FILE + 1055@1.1.1.1 -.. code:: console + .. tab-item:: Linux + :sync: key1 + + .. code:: console - printenv | grep ANSYSLMD_LICENSE_FILE + (.venv) user@machine:~$ printenv | grep ANSYSLMD_LICENSE_FILE + 1055@1.1.1.1 .. _vpn_issues_troubleshooting: @@ -229,12 +303,7 @@ In addition, if your device is inside a VPN, MAPDL might not be able to correctl resolve the IP of the license server. Verify that the hostname or IP address of the license server is correct. -On Windows, you can find the license configuration file that points to the license server in: - -.. code:: text - - C:\Program Files\ANSYS Inc\Shared Files\Licensing\ansyslmd.ini - +On Windows, you can find the license configuration file that points to the license server in ``C:\Program Files\ANSYS Inc\Shared Files\Licensing\ansyslmd.ini``. .. _missing_dependencies_on_linux: @@ -247,71 +316,99 @@ you get errors like ``libXp.so.6: cannot open shared object file: No such file or directory``, you are likely missing some necessary dependencies. -**CentOS 7** -On CentOS 7, you can install missing dependencies with: +.. tab-set:: -.. code:: console + .. tab-item:: CentOS 7 - yum install openssl openssh-clients mesa-libGL mesa-libGLU motif libgfortran + On CentOS 7, you can install missing dependencies with: + .. code:: console -**Ubuntu** + user@machine:~$ yum install openssl openssh-clients mesa-libGL mesa-libGLU motif libgfortran -On Ubuntu 22.04, use this code to install the needed dependencies: + .. tab-item:: Ubuntu 22.04 -.. code:: console + On Ubuntu 22.04, use this code to install the needed dependencies: - apt-get update + .. code:: console - # Install dependencies - apt-get install -y \ - openssh-client \ - libgl1 \ - libglu1 \ - libxm4 \ - libxi6 + user@machine:~$ apt-get update -The preceding code takes care of everything except for ``libxp6``, which you must install -using this code: + # Install dependencies + user@machine:~$ apt-get install -y \ + openssh-client \ + libgl1 \ + libglu1 \ + libxm4 \ + libxi6 -.. code:: console + The preceding code takes care of everything except for ``libxp6``, which you must install + using this code: - # This is a workaround - # Source: https://bugs.launchpad.net/ubuntu/+source/libxp/+bug/1517884 - apt install -y software-properties-common - add-apt-repository -y ppa:zeehio/libxp - apt-get update - apt-get install -y libxp6 + .. code:: console + # This is a workaround + # Source: https://bugs.launchpad.net/ubuntu/+source/libxp/+bug/1517884 + user@machine:~$ apt install -y software-properties-common + user@machine:~$ add-apt-repository -y ppa:zeehio/libxp + user@machine:~$ apt-get update + user@machine:~$ apt-get install -y libxp6 -**Ubuntu 20.04 and older** + .. tab-item:: Ubuntu 20.04 through 18.04 -If you are using Ubuntu 16.04, you can install ``libxp16`` with this code: + If you are using Ubuntu 20.04 through 18.04, you can install missing dependencies with: -.. code:: console + .. code:: console - sudo apt install libxp6. - -However, if you are using Ubuntu 18.04 through 20.04, you must manually -download and install the package. + user@machine:~$ apt-get update -Because ``libxpl6`` pre-depends on ``multiarch-support``, which is -also outdated, it must be removed. Otherwise you'll have a broken -package configuration. The following code downloads and modifies the -``libxp6`` package to remove the ``multiarch-support`` dependency and -then installs it via the ``dpkg`` package. + # Install dependencies + user@machine:~$ apt-get install -y \ + openssh-client \ + libgl1 \ + libglu1 \ + libxm4 \ + libxi6 -.. code:: console - cd /tmp - wget http://ftp.br.debian.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb - ar x libxp6_1.0.2-2_amd64.deb - sudo tar xzf control.tar.gz - sudo sed '/Pre-Depends/d' control -i - sudo bash -c "tar c postinst postrm md5sums control | gzip -c > control.tar.gz" - sudo ar rcs libxp6_1.0.2-2_amd64_mod.deb debian-binary control.tar.gz data.tar.xz - sudo dpkg -i ./libxp6_1.0.2-2_amd64_mod.deb + The preceding code takes care of everything except for ``libxp6``, which you must + manually download and install. + + Because ``libxpl6`` pre-depends on ``multiarch-support``, which is + also outdated, it must be removed. Otherwise you'll have a broken + package configuration. The following code downloads and modifies the + ``libxp6`` package to remove the ``multiarch-support`` dependency and + then installs it via the ``dpkg`` package. + + .. code:: console + + cd /tmp + wget http://ftp.br.debian.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb + ar x libxp6_1.0.2-2_amd64.deb + sudo tar xzf control.tar.gz + sudo sed '/Pre-Depends/d' control -i + sudo bash -c "tar c postinst postrm md5sums control | gzip -c > control.tar.gz" + sudo ar rcs libxp6_1.0.2-2_amd64_mod.deb debian-binary control.tar.gz data.tar.xz + sudo dpkg -i ./libxp6_1.0.2-2_amd64_mod.deb + + + .. tab-item:: Ubuntu 16.04 and older + + If you are using Ubuntu 16.04, you can install missing dependencies with: + + .. code:: console + + user@machine:~$ apt-get update + + # Install dependencies + user@machine:~$ apt-get install -y \ + openssh-client \ + libgl1 \ + libglu1 \ + libxm4 \ + libxi6 \ + libxp6 .. _conflicts_student_version: @@ -351,23 +448,23 @@ shown. For Ansys MAPDL 2022 R2, ``222`` appears where ``XXX`` is shown. .. code:: pwsh-session PS echo $env:AWP_ROOT222 - C:\Program Files\ANSYS Inc\ANSYS Student\v222 - PS $env:AWP_ROOT222 = "C:\Program Files\ANSYS Inc\v222" # This overwrites the env var for the terminal session only. - PS [System.Environment]::SetEnvironmentVariable('AWP_ROOT222','C:\Program Files\ANSYS Inc\v222',[System.EnvironmentVariableTarget]::User) # This changes the env var permanently. + C:\Program Files\ANSYS Inc\ANSYS Student\v241 + PS $env:AWP_ROOT222 = "C:\Program Files\ANSYS Inc\v241" # This overwrites the env var for the terminal session only. + PS [System.Environment]::SetEnvironmentVariable('AWP_ROOT222','C:\Program Files\ANSYS Inc\v241',[System.EnvironmentVariableTarget]::User) # This changes the env var permanently. PS echo $env:AWP_ROOT222 - C:\Program Files\ANSYS Inc\v222 + C:\Program Files\ANSYS Inc\v241 - PS echo $env:ANSYS222_DIR - C:\Program Files\ANSYS Inc\ANSYS Student\v222\ANSYS - PS [System.Environment]::SetEnvironmentVariable('ANSYS222_DIR','C:\Program Files\ANSYS Inc\v222\ANSYS',[System.EnvironmentVariableTarget]::User) - PS echo $env:ANSYS222_DIR - C:\Program Files\ANSYS Inc\v222\ANSYS + PS echo $env:ANSYS241_DIR + C:\Program Files\ANSYS Inc\ANSYS Student\v241\ANSYS + PS [System.Environment]::SetEnvironmentVariable('ANSYS241_DIR','C:\Program Files\ANSYS Inc\v241\ANSYS',[System.EnvironmentVariableTarget]::User) + PS echo $env:ANSYS241_DIR + C:\Program Files\ANSYS Inc\v241\ANSYS PS echo $env:CADOE_LIBDIR222 - C:\Program Files\ANSYS Inc\ANSYS Student\v222\CommonFiles\Language\en-us - PS [System.Environment]::SetEnvironmentVariable('CADOE_LIBDIR222','C:\Program Files\ANSYS Inc\v222\CommonFiles\Language\en-us',[System.EnvironmentVariableTarget]::User) + C:\Program Files\ANSYS Inc\ANSYS Student\v241\CommonFiles\Language\en-us + PS [System.Environment]::SetEnvironmentVariable('CADOE_LIBDIR222','C:\Program Files\ANSYS Inc\v241\CommonFiles\Language\en-us',[System.EnvironmentVariableTarget]::User) PS echo $env:CADOE_LIBDIR222 - C:\Program Files\ANSYS Inc\v222\CommonFiles\Language\en-us + C:\Program Files\ANSYS Inc\v241\CommonFiles\Language\en-us .. vale on @@ -428,7 +525,7 @@ method. .. code:: pycon >>> from ansys.mapdl.core import launch_mapdl - >>> exec_loc = "C:/Program Files/ANSYS Inc/v211/ansys/bin/winx64/ANSYS211.exe" + >>> exec_loc = "C:/Program Files/ANSYS Inc/v241/ansys/bin/winx64/ANSYS241.exe" >>> mapdl = launch_mapdl(exec_loc) **On Linux** @@ -436,7 +533,7 @@ method. .. code:: pycon >>> from ansys.mapdl.core import launch_mapdl - >>> exec_loc = "/usr/ansys_inc/v211/ansys/bin/ansys211" + >>> exec_loc = "/usr/ansys_inc/v241/ansys/bin/ansys241" >>> mapdl = launch_mapdl(exec_loc) @@ -451,24 +548,29 @@ available Ansys installations. Ansys installations are normally under: -.. code:: text - C:/Program Files/ANSYS Inc/vXXX +.. tab-set:: + .. tab-item:: Windows + :sync: key1 -**On Linux** + .. code:: text -Ansys installations are normally under: + C:/Program Files/ANSYS Inc/vXXX + + .. tab-item:: Linux + :sync: key1 + + .. code:: text -.. code:: text + /usr/ansys_inc/vXXX + + Or under: - /usr/ansys_inc/vXXX - -Or under: + .. code:: text -.. code:: text + /ansys_inc/vXXX - /ansys_inc/vXXX By default, Ansys installer uses the former one (``/usr/ansys_inc``) but also creates a symbolic to later one (``/ansys_inc``). @@ -491,8 +593,8 @@ To update this configuration file with the latest path, use: .. code:: pycon >>> from ansys.mapdl.core import save_ansys_path - >>> save_ansys_path(r"C:\Program Files\ANSYS Inc\v222\ansys\bin\winx64\ansys222.exe") - 'C:\\Program Files\\ANSYS Inc\\v222\\ansys\\bin\\winx64\\ansys222.exe' + >>> save_ansys_path(r"C:\Program Files\ANSYS Inc\v241\ansys\bin\winx64\ansys241.exe") + 'C:\\Program Files\\ANSYS Inc\\v241\\ansys\\bin\\winx64\\ansys241.exe' If you want to see which Ansys installations PyMAPDL has detected, use: @@ -500,9 +602,9 @@ If you want to see which Ansys installations PyMAPDL has detected, use: >>> from ansys.mapdl.core import get_available_ansys_installations >>> get_available_ansys_installations() - {222: 'C:\\Program Files\\ANSYS Inc\\v222', + {222: 'C:\\Program Files\\ANSYS Inc\\v241', 212: 'C:\\Program Files\\ANSYS Inc\\v212', - -222: 'C:\\Program Files\\ANSYS Inc\\ANSYS Student\\v222'} + -222: 'C:\\Program Files\\ANSYS Inc\\ANSYS Student\\v241'} Student versions are provided as **negative** versions because the Python dictionary does not accept two equal keys. The result of the diff --git a/doc/source/user_guide/upf.rst b/doc/source/user_guide/upf.rst index 57a4c9ebe6..86955d0a6a 100644 --- a/doc/source/user_guide/upf.rst +++ b/doc/source/user_guide/upf.rst @@ -9,7 +9,7 @@ Python language to code user programmable subroutines. A subset of the documented UPF subroutines support the Python UPF capability. For more information, see `Supported UPF subroutines`_). -You must install a Python distribution before using this feature. Python 3.8 +You must install a Python distribution before using this feature. Python 3.9 through Python 3.12 are supported. Python UPFs are only supported on Linux. diff --git a/doc/styles/Vocab/ANSYS/accept.txt b/doc/styles/Vocab/ANSYS/accept.txt index dd6329b7d1..60889c20a4 100644 --- a/doc/styles/Vocab/ANSYS/accept.txt +++ b/doc/styles/Vocab/ANSYS/accept.txt @@ -129,6 +129,7 @@ PyAnsys Math PyDPF-Core PyDPF-Post PyMAPDL +pymapdl Python QRDAMP Radiosity diff --git a/minimum_requirements.txt b/minimum_requirements.txt index 1cf96defdd..1d65119cae 100644 --- a/minimum_requirements.txt +++ b/minimum_requirements.txt @@ -1,5 +1,5 @@ ansys-api-mapdl==0.5.1 -importlib-metadata==7.0.1 +importlib-metadata==7.1.0 numpy==1.26.4 platformdirs==4.2.0 psutil==5.9.8 diff --git a/pyproject.toml b/pyproject.toml index b778585505..b792a3f3f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,10 +5,10 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections name = "ansys-mapdl-core" -version = "0.68.0" +version = "0.68.1" description = "A Python wrapper for Ansys MAPDL." readme = "README.md" -requires-python = ">=3.9,<3.13" +requires-python = ">=3.9,<3.13" # Update also 'MINIMUM_PYTHON_VERSION' in src/ansys/mapdl/core/__init__.py license = {file = "LICENSE"} authors = [ {name = "Ansys, Inc.", email = "pyansys.maintainers@ansys.com"}, @@ -63,17 +63,17 @@ jupyter = [ tests = [ "ansys-dpf-core==0.10.1", - "autopep8==2.0.4", + "autopep8==2.1.0", "matplotlib==3.8.3", "scipy==1.12.0", "pandas==2.2.1", "pyiges[full]==0.3.1", - "pytest==8.0.1", - "pytest-cov==4.1.0", - "pyvista==0.43.3", + "pytest==8.1.1", + "pytest-cov==5.0.0", + "pyvista==0.43.4", "pyansys-tools-report==0.7.0", "vtk==9.3.0", - "pytest-rerunfailures==13.0", + "pytest-rerunfailures==14.0", "pytest-pyvista==0.1.9", "pytest-memprof<0.3.0", ] @@ -81,21 +81,21 @@ doc = [ "sphinx==7.2.6", "ansys-dpf-core==0.10.1", "ansys-mapdl-reader==0.53.0", - "ansys-sphinx-theme==0.14.0", - "grpcio==1.62.0", + "ansys-sphinx-theme==0.14.1", + "grpcio==1.62.1", "imageio-ffmpeg==0.4.9", "imageio==2.34.0", "jupyter_sphinx==0.5.3", "jupyterlab>=3.2.8", "matplotlib==3.8.3", - "numpydoc==1.6.0", + "numpydoc==1.7.0", "pandas==2.2.1", - "plotly==5.19.0", + "plotly==5.20.0", "pyiges[full]==0.3.1", "pypandoc==1.13", "pytest-sphinx==0.6.0", "pythreejs==2.4.2", - "pyvista[trame]==0.43.3", + "pyvista[trame]==0.43.4", "sphinx-autobuild==2024.2.4", "sphinx-autodoc-typehints==1.25.2", "sphinx-copybutton==0.5.2", diff --git a/src/ansys/mapdl/core/__init__.py b/src/ansys/mapdl/core/__init__.py index c041fb0962..ab657eb987 100644 --- a/src/ansys/mapdl/core/__init__.py +++ b/src/ansys/mapdl/core/__init__.py @@ -36,7 +36,7 @@ os.makedirs(USER_DATA_PATH) DEPRECATING_MINIMUM_PYTHON_VERSION = True -MINIMUM_PYTHON_VERSION = (3, 8) +MINIMUM_PYTHON_VERSION = (3, 9) first_time_file = os.path.join(USER_DATA_PATH, ".firstime") if not os.path.exists(first_time_file): # pragma: no cover @@ -120,7 +120,7 @@ from ansys.mapdl.core.mapdl_grpc import MapdlGrpc as Mapdl from ansys.mapdl.core.misc import Information, Report, _check_has_ansys -from ansys.mapdl.core.pool import LocalMapdlPool +from ansys.mapdl.core.pool import MapdlPool from ansys.mapdl.core.theme import MapdlTheme, _apply_default_theme _HAS_ANSYS = _check_has_ansys() diff --git a/src/ansys/mapdl/core/_commands/apdl/abbreviations.py b/src/ansys/mapdl/core/_commands/apdl/abbreviations.py index 939048561b..bff4f124c9 100644 --- a/src/ansys/mapdl/core/_commands/apdl/abbreviations.py +++ b/src/ansys/mapdl/core/_commands/apdl/abbreviations.py @@ -77,8 +77,12 @@ def abbres(self, lab="", fname="", ext="", **kwargs): lab Label that specifies the read operation: - Replace current abbreviation set with these abbreviations (default). - Extend current abbreviation set with these abbreviations, replacing any of the - same name that already exist. + NEW + Replace current abbreviation set with these abbreviations (default). + + CHANGE + Extend current abbreviation set with these abbreviations, replacing any of the + same name that already exist. fname File name and directory path (248 characters maximum, including the diff --git a/src/ansys/mapdl/core/_commands/apdl/array_param.py b/src/ansys/mapdl/core/_commands/apdl/array_param.py index 307ca2152e..b697e3515d 100644 --- a/src/ansys/mapdl/core/_commands/apdl/array_param.py +++ b/src/ansys/mapdl/core/_commands/apdl/array_param.py @@ -32,9 +32,13 @@ def mfouri(self, oper="", coeff="", mode="", isym="", theta="", curve="", **kwar oper Type of Fourier operation: - Calculate Fourier coefficients COEFF from MODE, ISYM, - THETA, and CURVE. - Evaluate the Fourier curve CURVE from - COEFF, MODE, ISYM and THETA. + FIT + Calculate Fourier coefficients COEFF from MODE, ISYM, + THETA, and CURVE. + + EVAL + Evaluate the Fourier curve CURVE from + COEFF, MODE, ISYM and THETA. coeff Name of the array parameter vector containing the Fourier @@ -50,7 +54,11 @@ def mfouri(self, oper="", coeff="", mode="", isym="", theta="", curve="", **kwar the corresponding Fourier terms. The vector should contain keys for each term as follows: - Symmetric (cosine) term - Antisymmetric (sine) term. + 0 or 1 + Symmetric (cosine) term + + -1 + Antisymmetric (sine) term. theta, curve Names of the array parameter vectors containing the theta vs. curve @@ -174,16 +182,22 @@ def moper( oper Matrix operations: - * `INVERT` - ``(*MOPER, ParR, Par1, INVERT)`` + * `INVERT` + ``(*MOPER, ParR, Par1, INVERT)`` Square matrix invert: Inverts the ``n`` x ``n`` matrix in ``Par1`` into ``ParR``. The matrix must be well conditioned. - **Warning**: Non-independent or ill-conditioned equations can - cause erroneous results. - For large matrices, use the + .. warning:: + + Non-independent or ill-conditioned equations can + cause erroneous results. + + For large matrices, use the APDL Math operation ``*LSFACTOR`` for efficiency (see APDL Math). - * `MULT` - ``(*MOPER, ParR, Par1, MULT, Par2)`` + * `MULT` + ``(*MOPER, ParR, Par1, MULT, Par2)`` Matrix multiply: Multiplies ``Par1`` by ``Par2``. The number of rows of ``Par2`` must equal the number of columns of ``Par1`` for the operation. If ``Par2`` is input with a number of rows @@ -192,7 +206,8 @@ def moper( number of rows of ``Par2`` equal to the number of columns of ``Par1``. - * `COVAR` - ``(*MOPER, ParR, Par1, COVAR, Par2)`` + * `COVAR` + ``(*MOPER, ParR, Par1, COVAR, Par2)`` Covariance: The measure of association between two columns of the input matrix (``Par1``). ``Par1``, of size m runs (rows) by ``n`` data (columns) is first processed to produce a row @@ -202,7 +217,8 @@ def moper( ``n`` matrix (``ParR``) of covariances (with the variances as the diagonal terms). - * `CORR` - ``(*MOPER, ParR, Par1, CORR, Par2)`` + * `CORR` + ``(*MOPER, ParR, Par1, CORR, Par2)`` Correlation: The correlation coefficient between two variables. The input matrix (``Par1``), of size m runs (rows) by n data (columns), is first processed to produce a row @@ -212,7 +228,8 @@ def moper( ``n`` matrix (``ParR``) of correlation coefficients (with a value of 1.0 for the diagonal terms). - * `SOLV` - ``(*MOPER, ParR, Par1, SOLV, Par2)`` + * `SOLV` + ``(*MOPER, ParR, Par1, SOLV, Par2)`` Solution of simultaneous equations: Solves the set of ``n`` equations of n terms of the form ``an_1 x_1 + an_2 x_2 + ... + an_n x_n = b_n`` where ``Par1`` contains the matrix of @@ -226,7 +243,8 @@ def moper( APDL Math operation ``*LSFACTOR`` for efficiency (see APDL Math). - * `SORT` - ``(*MOPER, ParR, Par1, SORT, Par2, n1, n2, n3)`` + * `SORT` + ``(*MOPER, ParR, Par1, SORT, Par2, n1, n2, n3)`` Matrix sort: Sorts matrix ``Par1`` according to sort vector ``Par2`` and places the result back in ``Par1``. Rows of ``Par1`` are moved to the corresponding positions indicated by the @@ -238,7 +256,8 @@ def moper( row positions (the permutation vector). Sorting ``Par1`` according to ``ParR`` should reproduce the initial ordering. - * `NNEAR` - ``(*MOPER, ParR, Par1, NNEAR, Toler)`` + * `NNEAR` + ``(*MOPER, ParR, Par1, NNEAR, Toler)`` Nearest Node: Quickly determine all the nodes within a specified tolerance of a given array. ``ParR`` is a vector of the nearest selected nodes, or 0 if no nodes are nearer @@ -246,7 +265,8 @@ def moper( locations. ``Toler`` defaults to 1 and is limited to the maximum model size. - * `ENEAR` - ``(*MOPER, ``ParR``, ``Par1``, ENEAR, Toler)`` + * `ENEAR` + ``(*MOPER, ``ParR``, ``Par1``, ENEAR, Toler)`` Nearest Element: Quickly determine the elements with centroids that are within a specified tolerance of the points in a given array. - ``ParR`` is a vector of the nearest @@ -254,7 +274,8 @@ def moper( than ``Toler``. ``Par1`` is the ``n`` x 3 array of coordinate locations. - * `MAP` - ``(*MOPER, ParR, Par1, MAP, Par2, Par3, kDim, --, kOut, LIMIT)`` + * `MAP` + ``(*MOPER, ParR, Par1, MAP, Par2, Par3, kDim, --, kOut, LIMIT)`` Maps the results from one set of points to another. For example, you can map pressures from a CFD analysis onto your model for a structural analysis. @@ -297,14 +318,16 @@ def moper( bounds. Results mapping is available from the command line only. - * `INTP` - ``(*MOPER, ParR, Par1, INTP, Par2)`` + * `INTP` + ``(*MOPER, ParR, Par1, INTP, Par2)`` Finds the elements that contain each point in the array of ``n`` x 3 points in ``Par1``. ``Par2`` will contain the set of element ID numbers and ``ParR`` will contain their ``n`` x 3 set of natural element coordinates (values between -1 and 1). ``Par1`` must be in global Cartesian coordinates. - * `SGET` - ``(*MOPER, ParR, Par1, SGET, Par2, Label, Comp)`` + * `SGET` + ``(*MOPER, ParR, Par1, SGET, Par2, Label, Comp)`` Gets the nodal solution item corresponding to Label and Comp (see the PLNSOL command) and interpolates it to the given element locations. ``Par1`` contains the ``n`` x 3 array of @@ -1141,7 +1164,8 @@ def voper(self, parr="", par1="", oper="", par2="", con1="", con2="", **kwargs): First derivative: .. math:: - \dfrac{\mathrm{d}(\mathrm{Par1})}{\mathrm{d}(\mathrm{Par2})} + + \\dfrac{\\mathrm{d}(\\mathrm{Par1})}{\\mathrm{d}(\\mathrm{Par2})} The derivative at a point is determined over points half way between the previous and next points @@ -1154,7 +1178,8 @@ def voper(self, parr="", par1="", oper="", par2="", con1="", con2="", **kwargs): Second derivative: .. math:: - \dfrac{\mathrm{d}^2(\mathrm{Par1})}{\mathrm{d}(\mathrm{Par2})^2} + + \\dfrac{\\mathrm{d}^2(\\mathrm{Par1})}{\\mathrm{d}(\\mathrm{Par2})^2} See also ``DER1``. @@ -1163,7 +1188,7 @@ def voper(self, parr="", par1="", oper="", par2="", con1="", con2="", **kwargs): .. math:: - \int Par1 \, d(Par2) + \\int Par1 \\, d(Par2) where ``CON1`` is the integration constant. The integral at a point is @@ -1175,7 +1200,7 @@ def voper(self, parr="", par1="", oper="", par2="", con1="", con2="", **kwargs): .. math:: - \iint Par1 \, d(Par2) + \\iint Par1 \\, d(Par2) where ``CON1`` is the integration constant of the first integral and ``CON2`` is the integration constant diff --git a/src/ansys/mapdl/core/_commands/apdl/macro_files.py b/src/ansys/mapdl/core/_commands/apdl/macro_files.py index a3a0cf489d..21e44a24eb 100644 --- a/src/ansys/mapdl/core/_commands/apdl/macro_files.py +++ b/src/ansys/mapdl/core/_commands/apdl/macro_files.py @@ -356,7 +356,7 @@ def rmdir(self, dir_="", **kwargs): Parameters ---------- - dir\_ + dir\\_ The directory to remove. If no path is provided, it will be assumed to be in the current working directory. All files in the directory are also removed. diff --git a/src/ansys/mapdl/core/_commands/apdl/matrix_op.py b/src/ansys/mapdl/core/_commands/apdl/matrix_op.py index d836299b2c..99395622a8 100644 --- a/src/ansys/mapdl/core/_commands/apdl/matrix_op.py +++ b/src/ansys/mapdl/core/_commands/apdl/matrix_op.py @@ -102,7 +102,7 @@ def dmat( matrix Name used to identify the matrix. Must be specified. - type\_ + type\\_ Matrix type: Double precision real values (default). - Complex double precision values. @@ -239,7 +239,7 @@ def export( Name of the matrix to export (must be a matrix previously created with ``*DMAT`` or ``*SMAT``, or a vector previously created with ``*VEC``). - format\_ + format\\_ Format of the output file: Export the matrix in the Matrix Market Format. - Export @@ -302,7 +302,7 @@ def fft( Parameters ---------- - type\_ + type\\_ Type of FFT transformation: Forward FFT computation (default). - Backward FFT computation. @@ -420,7 +420,7 @@ def itengine( Parameters ---------- - type\_ + type\\_ Specifies the algorithm to be used: enginename @@ -834,7 +834,7 @@ def smat( matrix Name used to identify the matrix. Must be specified. - type\_ + type\\_ Matrix type: Double precision real values (default). - Complex double precision values. diff --git a/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py b/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py index 148341a79c..533af1a79e 100644 --- a/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py +++ b/src/ansys/mapdl/core/_commands/apdl/parameter_definition.py @@ -65,7 +65,7 @@ def dim( Name of parameter to be dimensioned. See ``*SET`` for name restrictions. - type\_ + type\\_ Array type: Arrays are similar to standard FORTRAN arrays (indices are @@ -261,7 +261,7 @@ def get( Parameters ---------- par : str, optional - The name of the resulting parameter. See \*SET for name + The name of the resulting parameter. See \\*SET for name restrictions. entity diff --git a/src/ansys/mapdl/core/_commands/aux12_/radiation_mat.py b/src/ansys/mapdl/core/_commands/aux12_/radiation_mat.py index f9f58f1b26..e82b43a7c7 100644 --- a/src/ansys/mapdl/core/_commands/aux12_/radiation_mat.py +++ b/src/ansys/mapdl/core/_commands/aux12_/radiation_mat.py @@ -58,9 +58,11 @@ def geom(self, k2d="", ndiv="", **kwargs): k2d Dimensionality key: - 0 - 3-D geometry (default) + 0 + 3-D geometry (default) - 1 - 2-D geometry (plane or axisymmetric) + 1 + 2-D geometry (plane or axisymmetric) ndiv Number of divisions in an axisymmetric model. Used only with K2D = @@ -82,9 +84,11 @@ def mprint(self, key="", **kwargs): key Print key: - 0 - Do not print matrices. + 0 + Do not print matrices. - 1 - Print matrices. + 1 + Print matrices. Notes ----- @@ -129,9 +133,11 @@ def vtype(self, nohid="", nzone="", **kwargs): nohid Type of viewing procedure: - 0 - Hidden procedure. + 0 + Hidden procedure. - 1 - Non-hidden (faster, but less general) procedure. + 1 + Non-hidden (faster, but less general) procedure. nzone Number of sampling zones for the hidden procedure (100 maximum for diff --git a/src/ansys/mapdl/core/_commands/aux12_/radiosity_solver.py b/src/ansys/mapdl/core/_commands/aux12_/radiosity_solver.py index 9b978d9f93..1d79b2a0af 100644 --- a/src/ansys/mapdl/core/_commands/aux12_/radiosity_solver.py +++ b/src/ansys/mapdl/core/_commands/aux12_/radiosity_solver.py @@ -62,11 +62,14 @@ def radopt( solver Choice of solver for radiosity calculation: - 0 - Gauss-Seidel iterative solver (default). + 0 + Gauss-Seidel iterative solver (default). - 1 - Direct solver. + 1 + Direct solver. - 2 - Jacobi solver. + 2 + Jacobi solver. maxiter Maximum number of iterations for iterative solver (SOLVER = 0 or @@ -84,22 +87,20 @@ def radopt( Maximum number of flux iterations to be performed according to the specified solver type: - 0 - If the FULL solver is specified (THOPT,FULL), convergence criteria are - monitored and iterations are performed until convergence - occurs. If the QUASI solver is specified (THOPT,QUASI), - convergence criteria are ignored and one iteration is - performed. This value is the default. - - 1, 2, 3, ...N - If the FULL solver is specified - (THOPT,FULL), convergence criteria are - monitored and iterations are performed - until convergence occurs, or until the - specified number of iterations has been - completed, whichever comes first. If the - QUASI solver is specified (THOPT,QUASI), - convergence criteria are ignored and the - specified number of iterations are - completed. + 0 + If the FULL solver is specified (``THOPT,FULL``), convergence + criteria are monitored and iterations are performed until + convergence occurs. If the QUASI solver is specified + (``THOPT,QUASI``), convergence criteria are ignored and one + iteration is performed. This value is the default. + + 1, 2, 3, ...N + If the FULL solver is specified (``THOPT,FULL``), convergence + criteria are monitored and iterations are performed until + convergence occurs, or until the specified number of iterations + has been completed, whichever comes first. If the QUASI solver + is specified (``THOPT,QUASI``), convergence criteria are ignored and + the specified number of iterations are completed. Notes ----- @@ -232,9 +233,11 @@ def v2dopt(self, geom="", ndiv="", hidopt="", nzone="", **kwargs): geom Choice of geometry: - 0 - Planar (default). + 0 + Planar (default). - 1 - Axisymmetric + 1 + Axisymmetric ndiv Number of divisions for axisymmetric geometry (that is, the number @@ -243,9 +246,11 @@ def v2dopt(self, geom="", ndiv="", hidopt="", nzone="", **kwargs): hidopt Viewing option: - 0 - Hidden (default). + 0 + Hidden (default). - 1 - Non-hidden + 1 + Non-hidden nzone Number of zones (that is, the number of rays emanating from a @@ -266,12 +271,15 @@ def vfsm(self, action="", encl="", opt="", maxiter="", conv="", **kwargs): action Action to be performed: - Define - Define a view factor summation (default) + Define + Define a view factor summation (default) - Clear - Resets the scaling method to 0 for all - enclosures. All subsequent arguments are ignored. + Clear + Resets the scaling method to 0 for all + enclosures. All subsequent arguments are ignored. - Status - Outputs the OPT value for each enclosure in the model. + Status + Outputs the OPT value for each enclosure in the model. encl Previously defined enclosure number for the view factor adjustment. @@ -279,19 +287,24 @@ def vfsm(self, action="", encl="", opt="", maxiter="", conv="", **kwargs): opt Option key: - 0 - The view factor matrix values are not adjusted (default). + 0 + The view factor matrix values are not adjusted (default). - 1 - The view factor matrix values are adjusted so that the + 1 + The view factor matrix values are adjusted so that the row sum equals 1.0. - 2 - The view factor matrix values are adjusted so that the + 2 + The view factor matrix values are adjusted so that the row sum equals 1.0 and the reciprocity relationship is satisfied. - 3 - The view factor matrix values are adjusted so that the + 3 + The view factor matrix values are adjusted so that the original row sum is maintained. - 4 - The view factor matrix values are adjusted so that the + 4 + The view factor matrix values are adjusted so that the original row sum is maintained and the reciprocity relationship is satisfied. @@ -343,16 +356,20 @@ def vfopt( opt View factor option: - NEW - Calculate view factors and write them to a file. + NEW + Calculate view factors and write them to a file. - OFF - Do not recalculate view factors it they already exist in the database, + OFF + Do not recalculate view factors it they already exist in the database, otherwise calculate compute them. This option is the default behavior. - READ - Read view factors from a binary file. For subsequent SOLVE commands, switch to + READ + Read view factors from a binary file. For subsequent SOLVE commands, switch to the default option (OFF). - NONE - Do not write view factors to a file. + NONE + Do not write view factors to a file. fname File name for view factor matrix. Default = Jobname. @@ -360,23 +377,38 @@ def vfopt( ext Filename extension for view factor matrix. Default = .vf. - dir\_ + dir\\_ Directory path for view factor matrix. If you do not specify a directory path, it will default to your working directory. filetype View factor file type: - BINA - Binary (default). + BINA + Binary (default). - ASCI - ASCII. + ASCI + ASCII. fileformat Format for the specified Filetype: - Binary files (Filetype = BINA): - 0 + Binary files (Filetype = BINA): - No compression. (View factor file size may be very large.) - 1 + 0 + No compression. (View factor file size may be very large.) + + 1 + Zeroes are compressed out. (Useful for large models to reduce + the view factor file size.) + + ASCII files (Filetype = ASCI): + + 0 + 10F7.4 (low precision, lower accuracy). + + 1 + 7F11.8 (high precision, higher accuracy). Notes ----- diff --git a/src/ansys/mapdl/core/_commands/aux15_.py b/src/ansys/mapdl/core/_commands/aux15_.py index 010165b90a..00c6f58792 100644 --- a/src/ansys/mapdl/core/_commands/aux15_.py +++ b/src/ansys/mapdl/core/_commands/aux15_.py @@ -90,42 +90,60 @@ def ioptn(self, lab="", val1="", **kwargs): Label identifying the import option. The meaning of VAL1 varies depending on Lab. - STAT - List overall status of import facilities, including current option values. - VAL1 is ignored. + STAT + List overall status of import facilities, including current option values. + VAL1 is ignored. - DEFA - Set default values for all import options. VAL1is ignored. + DEFA + Set default values for all import options. VAL1is ignored. - MERG - Entity merge option. VAL1 can be: + MERG + Entity merge option. VAL1 can be: - YES - Automatic merging is performed (default). + YES + Automatic merging is performed (default). - NO - No merging of entities. + NO + No merging of entities. - SOLID - Solid option. VAL1 can be: + SOLID + Solid option. VAL1 can be: - YES - Solid is created automatically (default). + YES + Solid is created automatically (default). - NO - No solid created. + NO + No solid created. - GTOLER - Entity merging tolerance. If IGES = SMOOTH, the GTOLER,VAL1 can be: + GTOLER + Entity merging tolerance. If IGES = SMOOTH, the GTOLER,VAL1 can be: - DEFA - Use system defaults (default). + DEFA + Use system defaults (default). - FILE - Use tolerance from the imported file. + FILE + Use tolerance from the imported file. - n - A user-specified tolerance value. + n + A user-specified tolerance value. - IGES - IGES import option. VAL1 can be: + IGES + IGES import option. VAL1 can be: - STAT - List status of IGES related options in the output window. + STAT + List status of IGES related options in the output window. - SMOOTH (or RV52) - Use more robust IGES revision 5.2 import function (default). + SMOOTH (or RV52) + Use more robust IGES revision 5.2 import function (default). - SMALL - Small areas option. VAL1 can be: + SMALL + Small areas option. VAL1 can be: - YES - Small areas are deleted (default). + YES + Small areas are deleted (default). - NO - Small areas are retained. + NO + Small areas are retained. val1 Additional input value as described under each Lab option. diff --git a/src/ansys/mapdl/core/_commands/aux2_/bin_dump.py b/src/ansys/mapdl/core/_commands/aux2_/bin_dump.py index b1899e48a1..8e7538ec35 100644 --- a/src/ansys/mapdl/core/_commands/aux2_/bin_dump.py +++ b/src/ansys/mapdl/core/_commands/aux2_/bin_dump.py @@ -79,11 +79,14 @@ def form(self, lab="", **kwargs): lab Format: - RECO - Basic record description only (minimum output) (default). + RECO + Basic record description only (minimum output) (default). - TEN - Same as RECO plus the first ten words of each record. + TEN + Same as RECO plus the first ten words of each record. - LONG - Same as RECO plus all words of each record. + LONG + Same as RECO plus all words of each record. Notes ----- diff --git a/src/ansys/mapdl/core/_commands/aux2_/bin_manip.py b/src/ansys/mapdl/core/_commands/aux2_/bin_manip.py index 71c2c53285..303b1a40cb 100644 --- a/src/ansys/mapdl/core/_commands/aux2_/bin_manip.py +++ b/src/ansys/mapdl/core/_commands/aux2_/bin_manip.py @@ -33,29 +33,41 @@ def combine(self, filetype="", **kwargs): Type of solution file to combine. There is no default; if (blank), the command is ignored. - RST - Structural results file (.RST) + RST + Structural results file (.RST) - RTH - Thermal results file (.RTH) + RTH + Thermal results file (.RTH) - RMG - Magnetics results file (.RMG) + RMG + Magnetics results file (.RMG) - RSTP - Linear perturbation results file (.RSTP) + RSTP + Linear perturbation results file (.RSTP) - EMAT - Element matrix file (.EMAT). + EMAT + Element matrix file (.EMAT). - ESAV - Element saved data file (.ESAV) + ESAV + Element saved data file (.ESAV) - MODE - Modal results file (.MODE) + MODE + Modal results file (.MODE) - MLV - Modal load vector file (.MLV) + MLV + Modal load vector file (.MLV) - IST - Initial state file (.IST) + IST + Initial state file (.IST) - FULL - Full matrix file (.FULL) + FULL + Full matrix file (.FULL) - RFRQ - Reduced complex displacement file (.RFRQ) + RFRQ + Reduced complex displacement file (.RFRQ) - RDSP - Reduced displacement file (.RDSP) + RDSP + Reduced displacement file (.RDSP) Notes ----- @@ -111,39 +123,48 @@ def hbmat(self, fname="", ext="", form="", matrx="", rhs="", mapping="", **kwarg form Specifies format of output matrix file: - ASCII - Write output matrix file in ASCII form. + ASCII + Write output matrix file in ASCII form. - BIN - Write output matrix file in binary form. + BIN + Write output matrix file in binary form. matrx Specify which matrix to write to the output matrix file: - STIFF - Write stiffness matrix to output matrix file. Valid for all types of analyses - that write a .FULL file. + STIFF + Write stiffness matrix to output matrix file. Valid for all types of analyses + that write a .FULL file. - MASS - Write mass matrix to output matrix file. Valid for buckling, substructure, and - modal analyses. If .FULL file was generated in a buckling - analysis, then this label will write stress stiffening - matrix to output matrix file. + MASS + Write mass matrix to output matrix file. Valid for buckling, substructure, and + modal analyses. If .FULL file was generated in a buckling + analysis, then this label will write stress stiffening + matrix to output matrix file. - DAMP - Write damping matrix to output matrix file. Only valid for damped modal - analyses. + DAMP + Write damping matrix to output matrix file. Only valid for damped modal + analyses. rhs Specifies whether to write the right-hand side vector to output matrix file: - YES - Write right-hand side vector to output matrix file. + YES + Write right-hand side vector to output matrix file. - NO - Do not write right-hand side vector to output matrix file. + NO + Do not write right-hand side vector to output matrix file. mapping Specifies whether to write the mapping file. This file is always named Fname.MAPPING. - YES - Write the mapping file. + YES + Write the mapping file. - NO - Do not write the mapping file (default). + NO + Do not write the mapping file (default). Notes ----- @@ -232,27 +253,32 @@ def psmat(self, fname="", ext="", matrix="", color="", **kwargs): matrix Specify which matrix to write to the output postscript file: - STIFF - Write stiffness matrix to output postscript file. Valid for all types of - analyses that write a .FULL file. + STIFF + Write stiffness matrix to output postscript file. Valid for all types of + analyses that write a .FULL file. - MASS - Write mass matrix to output postscript file. Valid for buckling, substructure, - and modal analyses. If the .FULL file was generated in a - buckling analysis, then this label will write the stress - stiffening matrix to the output postscript file. + MASS + Write mass matrix to output postscript file. Valid for buckling, substructure, + and modal analyses. If the .FULL file was generated in a + buckling analysis, then this label will write the stress + stiffening matrix to the output postscript file. - DAMP - Write damping matrix to output postscript file. Only valid for damped modal - analyses. + DAMP + Write damping matrix to output postscript file. Only valid for damped modal + analyses. color Specifies whether to display the grid in black and white or in color: - BLACK - Each nonzero coefficient is symbolized by a black square (default). + BLACK + Each nonzero coefficient is symbolized by a black square (default). - COLOR - Each nonzero coefficient is symbolized by a colored square. The color depends - on the module of the coefficient; the range is from blue - for the smallest values to red for the largest values. The - color map is: + COLOR + Each nonzero coefficient is symbolized by a colored square. The color depends + on the module of the coefficient; the range is from blue + for the smallest values to red for the largest values. The + color map is: Notes ----- diff --git a/src/ansys/mapdl/core/_commands/aux3_.py b/src/ansys/mapdl/core/_commands/aux3_.py index 21ac17238a..54c5f6fef0 100644 --- a/src/ansys/mapdl/core/_commands/aux3_.py +++ b/src/ansys/mapdl/core/_commands/aux3_.py @@ -88,13 +88,13 @@ def modify( Parameters ---------- - set\_ + set\\_ Set of data in results file to be modified. lstep The new load step number. - iter\_ + iter\\_ The new load substep number. cumit @@ -106,9 +106,11 @@ def modify( ktitle Indicates if the set title should be modified. - 0 - Keep the original title. + 0 + Keep the original title. - 1 - Change the title to the title specified with the most current /TITLE command. + 1 + Change the title to the title specified with the most current /TITLE command. Notes ----- @@ -135,10 +137,12 @@ def undelete(self, option="", nstart="", nend="", **kwargs): option Specifies which sets are to be removed from the selected sets. - SET - Specifies one or more particular sets in the results file that are to be - removed from the group of sets selected for deletion. + SET + Specifies one or more particular sets in the results file that are to be + removed from the group of sets selected for deletion. - ALL - Removes all selected sets that are currently selected for deletion. + ALL + Removes all selected sets that are currently selected for deletion. nstart The first set to be removed from the set selected for deletion. diff --git a/src/ansys/mapdl/core/_commands/conn.py b/src/ansys/mapdl/core/_commands/conn.py index 77d55d9d03..d843d95c25 100644 --- a/src/ansys/mapdl/core/_commands/conn.py +++ b/src/ansys/mapdl/core/_commands/conn.py @@ -54,33 +54,42 @@ def cat5in( entity Entity to be imported. - SOLIDS - Solids only, imported as ANSYS volumes (default). + SOLIDS + Solids only, imported as ANSYS volumes (default). - SURFACES - Surfaces only, imported as ANSYS areas. + SURFACES + Surfaces only, imported as ANSYS areas. - ALL - All entities. Use this option when the file contains different types of - entities. + ALL + All entities. Use this option when the file contains different types of + entities. fmt The format in which ANSYS will store the model. - 0 - Neutral format (default). Defeaturing after import is restricted. + 0 + Neutral format (default). Defeaturing after import is restricted. - 1 - Solid format; this allows defeaturing after import. + 1 + Solid format; this allows defeaturing after import. nocl Remove tiny objects. - 0 - Remove tiny objects without checking model validity (default). + 0 + Remove tiny objects without checking model validity (default). - 1 - Do not remove tiny objects. + 1 + Do not remove tiny objects. noan Perform an analysis of the model. - 0 - Analyze the model (default). + 0 + Analyze the model (default). - 1 - Do not analyze the model. + 1 + Do not analyze the model. Notes ----- @@ -103,7 +112,7 @@ def catiain(self, name="", extension="", path="", blank="", **kwargs): name The name of a valid CATIA model, created with CATIA 4.x or lower. The first character of the file name must be an - alphanumeric. Special characters such as & - and * and + alphanumeric. Special characters such as ``&`` ``-`` and ``*`` and spaces are not permitted in the part name. extension @@ -117,10 +126,12 @@ def catiain(self, name="", extension="", path="", blank="", **kwargs): blank Sets whether to import "blanked" entities. - 0 - Does not import "blanked" (suppressed) CATIA entities (default). + 0 + Does not import "blanked" (suppressed) CATIA entities (default). - 1 - Imports "blanked" entities. The portions of CATIA data - that were suppressed will be included in the import. + 1 + Imports "blanked" entities. The portions of CATIA data + that were suppressed will be included in the import. Notes ----- @@ -163,31 +174,39 @@ def parain( entity Entity to be imported: - SOLIDS - Solids only, imported as ANSYS volumes (default) + SOLIDS + Solids only, imported as ANSYS volumes (default) - SURFACES - Surfaces only, imported as ANSYS areas. + SURFACES + Surfaces only, imported as ANSYS areas. - WIREFRAME - Wireframe only, imported as ANSYS lines. + WIREFRAME + Wireframe only, imported as ANSYS lines. - ALL - All entities. Use this option when the file contains - more than one type of entity. + ALL + All entities. Use this option when the file contains + more than one type of entity. fmt Sets the format in which ANSYS will store the model - 0 - Neutral format (default). Defeaturing after import is + 0 + Neutral format (default). Defeaturing after import is restricted. Use this option if you need to scale a model to a specific unit of measure (other than meters). - 1 - Solid format; this allows defeaturing after import. + 1 + Solid format; this allows defeaturing after import. scale Allows scaling for the model - 0 - Do not rescale the model; retain the default Parasolid + 0 + Do not rescale the model; retain the default Parasolid setting of meters (default). - 1 - Scale the model if warranted by the model size. + 1 + Scale the model if warranted by the model size. Notes ----- @@ -207,7 +226,7 @@ def proein(self, name="", extension="", path="", proecomm="", **kwargs): name The name of the Creo Parametric part to be imported, which cannot exceed 64 characters in length and must begin with an alphanumeric - character. Special characters such as & - and * and spaces are not + character. Special characters such as ``&`` ``-`` and ``*`` and spaces are not permitted in the part name. extension @@ -253,7 +272,7 @@ def satin( name The name of a valid .SAT file, created with a supported version of ACIS. The first character of the file name must be an alphanumeric. - Special characters such as & - and * and spaces are not permitted + Special characters such as ``&`` ``-`` and ``*`` and spaces are not permitted in the part name. See File Names in the Command Reference for more information about ANSYS file naming conventions. @@ -268,35 +287,45 @@ def satin( entity Entity to be imported. - SOLIDS - Solids only, imported as ANSYS volumes (Not implemented, imports All). + SOLIDS + Solids only, imported as ANSYS volumes (Not implemented, imports All). - SURFACES - Surfaces only, imported as ANSYS areas (Not implemented, imports All). + SURFACES + Surfaces only, imported as ANSYS areas (Not implemented, imports All). - WIREFRAME - Wireframe only, imported as ANSYS lines (Not implemented, imports All). + WIREFRAME + Wireframe only, imported as ANSYS lines (Not implemented, imports All). - ALL - All entities. Use this option when the file contains different types of - entities. + ALL + All entities. Use this option when the file contains different types of + entities. fmt The format in which ANSYS will store the model. - 0 - Neutral format (default). Defeaturing after import is restricted. + 0 + Neutral format (default). Defeaturing after import is restricted. - 1 - Solid format; this allows defeaturing after import. + 1 + Solid format; this allows defeaturing after import. nocl Remove tiny objects. - 0 - Remove tiny objects without checking model validity (default). + 0 + Remove tiny objects without checking model validity (default). - 1 - Do not remove tiny objects. + 1 + Do not remove tiny objects. noan Perform an ACIS analysis of the model. - 0 - Analyze the model (default). + 0 + Analyze the model (default). - 1 - Do not analyze the model. + 1 + Do not analyze the model. Notes ----- @@ -339,17 +368,21 @@ def ugin( entity Entity to be imported. - 0 or Solid - Solids only, imported as ANSYS volumes (the - default). + 0 or Solid + Solids only, imported as ANSYS volumes (the + default). - 1 or Surface - Surfaces only, imported as ANSYS areas. + 1 or Surface + Surfaces only, imported as ANSYS areas. - 2 or Wireframe - Wireframe only, imported as ANSYS lines. + 2 or Wireframe + Wireframe only, imported as ANSYS lines. - 3 or All - All entities. Use this option when the part - contains entities that may not be attached to each - other, such as a solid in one location and a - surface in another. + 3 or All + All entities. Use this option when the part + contains entities that may not be attached to each + other, such as a solid in one location and a + surface in another. layer The number(s) assigned to the layer(s) to be imported. You can @@ -359,9 +392,11 @@ def ugin( fmt The format in which ANSYS will store the model. - 0 - Neutral format (default). Defeaturing after import is restricted. + 0 + Neutral format (default). Defeaturing after import is restricted. - 1 - Solid format; this allows defeaturing after import. + 1 + Solid format; this allows defeaturing after import. Notes ----- diff --git a/src/ansys/mapdl/core/_commands/database/components.py b/src/ansys/mapdl/core/_commands/database/components.py index 4db5d79815..32ce86a4d0 100644 --- a/src/ansys/mapdl/core/_commands/database/components.py +++ b/src/ansys/mapdl/core/_commands/database/components.py @@ -50,17 +50,23 @@ def cm( entity Label identifying the type of geometry items to be grouped: - VOLU - Volumes. + VOLU + Volumes. - AREA - Areas. + AREA + Areas. - LINE - Lines. + LINE + Lines. - KP - Keypoints. + KP + Keypoints. - ELEM - Elements. + ELEM + Elements. - NODE - Nodes. + NODE + Nodes. Notes ----- @@ -154,10 +160,12 @@ def cmedit( oper Operation label: - ADD - To add more components. The level of any assembly to be added must be lower - than that of the assembly Aname (see CMGRP command). + ADD + To add more components. The level of any assembly to be added must be lower + than that of the assembly Aname (see CMGRP command). - DELE - To remove components. + DELE + To remove components. cnam1, cnam2, cnam3, . . . , cnam7 Names of components and assemblies to be added to or deleted from @@ -244,24 +252,32 @@ def cmlist( key Expansion key: - 0 - Do not list individual entities in the component. + 0 + Do not list individual entities in the component. - 1 or EXPA - List individual entities in the component. + 1 or EXPA + List individual entities in the component. entity If Name is blank, then the following entity types can be specified: - VOLU - List the volume components only. + VOLU + List the volume components only. - AREA - List the area components only. + AREA + List the area components only. - LINE - List the line components only. + LINE + List the line components only. - KP - List the keypoint components only + KP + List the keypoint components only - ELEM - List the element components only. + ELEM + List the element components only. - NODE - List the node components only. + NODE + List the node components only. Notes ----- @@ -328,38 +344,50 @@ def cmplot( label Name of the component or assembly to be plotted. - (blank) - All selected components and assemblies are plotted (default). If fewer than 11 - components are selected, then all are plotted. If more - than 11 components are selected, then only the first 11 - are plotted. + (blank) + All selected components and assemblies are plotted (default). If fewer than 11 + components are selected, then all are plotted. If more + than 11 components are selected, then only the first 11 + are plotted. - ALL - All selected components are plotted. If number of selected components is - greater than 11, then the legend showing component names will - not be shown. + ALL + All selected components are plotted. If number of selected components is + greater than 11, then the legend showing component names will + not be shown. - N - Next set of defined components and assemblies is plotted. + N + Next set of defined components and assemblies is plotted. - P - Previous set of defined components and assemblies is plotted. + P + Previous set of defined components and assemblies is plotted. - Cname - The specified component or assembly is plotted. + Cname + The specified component or assembly is plotted. - SetNo. - The specified set number is plotted. + SetNo. + The specified set number is plotted. entity If Label is BLANK or ALL, then the following entity types can be specified: - VOLU - Plot the volume components only. + VOLU + Plot the volume components only. - AREA - Plot the area components only. + AREA + Plot the area components only. - LINE - Plot the line components only. + LINE + Plot the line components only. - KP - Plot the keypoint components only. + KP + Plot the keypoint components only. - ELEM - Plot the element components only. + ELEM + Plot the element components only. - NODE - Plot the node components only. + NODE + Plot the node components only. keyword For Keyword = ALL, plot the specified component name in the Label @@ -394,20 +422,27 @@ def cmsel( Parameters ---------- - type\_ + type_ + Label identifying the type of select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. - ALL - Also select all components. + ALL + Also select all components. - NONE - Unselect all components. + NONE + Unselect all components. name Name of component or assembly whose items are to be selected (valid @@ -416,17 +451,23 @@ def cmsel( entity If Name is blank, then the following entity types can be specified: - VOLU - Select the volume components only. + VOLU + Select the volume components only. - AREA - Select the area components only. + AREA + Select the area components only. - LINE - Select the line components only. + LINE + Select the line components only. - KP - Select the keypoint components only. + KP + Select the keypoint components only. - ELEM - Select the element components only. + ELEM + Select the element components only. - NODE - Select the node components only. + NODE + Select the node components only. Notes ----- @@ -471,54 +512,63 @@ def cmwrite( option Selects which data to write: - ALL - Write all appropriate geometry, material property, - load, and component data (default). Two files will - be produced. Fname.Ext will contain all data items - mentioned in "Notes", except the solid model - data. Fnamei.Exti will contain the solid model - geometry and solid model loads data in the form of - IGES commands. This option is not valid when - CDOPT,ANF is active. - - COMB - Write all data mentioned, but to a single file, - Fname.Ext. Solid model geometry data will be - written in either IGES or ANF format as specified - in the CDOPT command, followed by the remainder of - the data in the form of ANSYS commands. More - information on these (IGES/ANF) file formats is - provided in "Notes". - - DB - Write all database information except the solid model - and solid model loads to Fname.Ext in the form of - ANSYS commands. This option is not valid when - CDOPT,ANF is active. - - SOLID - Write only the solid model geometry and solid - model load data. This output will be in IGES or - ANF format, as specified in the CDOPT - command. More information on these (IGES/ANF) file - formats is provided in "Notes". - - GEOM - Write only element and nodal geometry data. Neither - solid model geometry nor element attribute data - will be written. One file, Fname.Ext, will be - produced. Use CDREAD,DB to read in a file written - with this option. Element types [ET] compatible - with the connectivity of the elements on the file - must first be defined before reading the file in - with CDREAD,DB. - - CM - Write only node and element component and geometry - data to Fname.Ext. - - MAT - Write only material property data (both linear and - nonlinear) to Fname.Ext . - - LOAD - Write only loads for current load step to - Fname.Ext. - - SECT - Write only section data to Fname.Ext. Pretension - sections are not included. + ALL + Write all appropriate geometry, material property, + load, and component data (default). Two files will + be produced. ``Fname.Ext`` will contain all data items + mentioned in "Notes", except the solid model + data. Fnamei.Exti will contain the solid model + geometry and solid model loads data in the form of + IGES commands. This option is not valid when + CDOPT,ANF is active. + + COMB + Write all data mentioned, but to a single file, + ``Fname.Ext``. Solid model geometry data will be + written in either IGES or ANF format as specified + in the CDOPT command, followed by the remainder of + the data in the form of ANSYS commands. More + information on these (IGES/ANF) file formats is + provided in "Notes". + + DB + Write all database information except the solid model + and solid model loads to ``Fname.Ext`` in the form of + ANSYS commands. This option is not valid when + CDOPT,ANF is active. + + SOLID + Write only the solid model geometry and solid + model load data. This output will be in IGES or + ANF format, as specified in the CDOPT + command. More information on these (IGES/ANF) file + formats is provided in "Notes". + + GEOM + Write only element and nodal geometry data. Neither + solid model geometry nor element attribute data + will be written. One file, ``Fname.Ext``, will be + produced. Use CDREAD,DB to read in a file written + with this option. Element types [ET] compatible + with the connectivity of the elements on the file + must first be defined before reading the file in + with CDREAD,DB. + + CM + Write only node and element component and geometry + data to ``Fname.Ext``. + + MAT + Write only material property data (both linear and + nonlinear) to ``Fname.Ext`` . + + LOAD + Write only loads for current load step to + ``Fname.Ext``. + + SECT + Write only section data to ``Fname.Ext``. Pretension + sections are not included. fname @@ -552,22 +602,24 @@ def cmwrite( fmat Format of the output file (defaults to BLOCKED). - BLOCKED - Blocked format. This format allows faster - reading of the output file. The time savings is - most significant when BLOCKED is used to read - .cdb files associated with very large models. + BLOCKED + Blocked format. This format allows faster + reading of the output file. The time savings is + most significant when BLOCKED is used to read + .cdb files associated with very large models. - UNBLOCKED - Unblocked format. + UNBLOCKED + Unblocked format. Notes ----- Load data includes the current load step only. Loads applied to the solid model (if any) are automatically transferred to - the finite element model when this command is issued. CDWRITE + the finite element model when this command is issued. ``CDWRITE`` writes out solid model loads for meshed models only. If the model is not meshed, the solid model loads cannot be saved. Component data include component definitions, but not - assembly definitions. Appropriate NUMOFF commands are included + assembly definitions. Appropriate ``NUMOFF`` commands are included at the beginning of the file; this is to avoid overlap of an existing database when the file is read in. @@ -575,34 +627,34 @@ def cmwrite( file unless you specifically change a default solution setting. - CDWRITE does not support the GSBDATA and GSGDATA commands, and + ``CDWRITE`` does not support the ``GSBDATA`` and ``GSGDATA`` commands, and these commands are not written to the file. The data may be reread (on a different machine, for example) - with the CDREAD command. Caution: When the file is read in, - the NUMOFF,MAT command may cause a mismatch between material + with the ``CDREAD`` command. Caution: When the file is read in, + the ``NUMOFF,MAT`` command may cause a mismatch between material definitions and material numbers referenced by certain loads - and element real constants. See NUMOFF for details. Also, be - aware that the files created by the CDWRITE command explicitly + and element real constants. See ``NUMOFF`` for details. Also, be + aware that the files created by the ``CDWRITE`` command explicitly set the active coordinate system to Cartesian (CSYS,0). You should generally use the blocked format (Fmat = BLOCKED) - when writing out model data with CDWRITE. This is a compressed + when writing out model data with ``CDWRITE``. This is a compressed data format that greatly reduces the time required to read large models through the CDREAD command. The blocked and unblocked formats are described in Chapter 3 of the Guide to Interfacing with ANSYS. - If you use CDWRITE in any of the derived products (ANSYS + If you use ``CDWRITE`` in any of the derived products (ANSYS Mechanical Pro, ANSYS Mechanical Premium), then before reading the file, you must edit the Jobname.cdb file to remove commands that are not available in the respective component product. - The CDWRITE command writes PART information for any ANSYS + The ``CDWRITE`` command writes PART information for any ANSYS LS-DYNA input file to the Jobname.cdb file via the EDPREAD command. (EDPREAD is not a documented command; it is written - only when the CDWRITE command is issued.) The PART information + only when the ``CDWRITE`` command is issued.) The PART information can be automatically read in via the CDREAD command; however, if more than one Jobname.cdb file is read, the PART list from the last Jobname.cdb file overwrites the existing PART list of @@ -614,7 +666,7 @@ def cmwrite( so requires that no used combination of MAT/TYPE/REAL appears more than once in the list. - The CDWRITE command does not support (for beam meshing) any + The ``CDWRITE`` command does not support (for beam meshing) any line operation that relies on solid model associativity. For example, meshing the areas adjacent to the meshed line, plotting the line that contains the orientation nodes, or diff --git a/src/ansys/mapdl/core/_commands/database/coord_sys.py b/src/ansys/mapdl/core/_commands/database/coord_sys.py index aadffd068b..7b22606fef 100644 --- a/src/ansys/mapdl/core/_commands/database/coord_sys.py +++ b/src/ansys/mapdl/core/_commands/database/coord_sys.py @@ -53,13 +53,17 @@ def clocal( kcs Coordinate system type: - 0 or CART - Cartesian + 0 or CART + Cartesian - 1 or CYLIN - Cylindrical (circular or elliptical) + 1 or CYLIN + Cylindrical (circular or elliptical) - 2 or SPHE - Spherical (or spheroidal) + 2 or SPHE + Spherical (or spheroidal) - 3 or TORO - Toroidal + 3 or TORO + Toroidal xl, yl, zl Location (in the active coordinate system) of the origin of the new @@ -129,13 +133,17 @@ def cs( kcs Coordinate system type: - 0 or CART - Cartesian + 0 or CART + Cartesian - 1 or CYLIN - Cylindrical (circular or elliptical) + 1 or CYLIN + Cylindrical (circular or elliptical) - 2 or SPHE - Spherical (or spheroidal) + 2 or SPHE + Spherical (or spheroidal) - 3 or TORO - Toroidal + 3 or TORO + Toroidal norig Node defining the origin of this coordinate system. If NORIG = P, @@ -197,16 +205,20 @@ def cscir(self, kcn="", kthet="", kphi="", **kwargs): Theta singularity location for cylindrical, spherical, and toroidal systems: - 0 - Singularity at ±180°. + 0 + Singularity at ±180°. - 1 - Singularity at 0° (360°). + 1 + Singularity at 0° (360°). kphi Phi singularity location for toroidal systems: - 0 - Singularity in phi direction at ±180°. + 0 + Singularity in phi direction at ±180°. - 1 - Singularity in phi direction at 0° (360°). + 1 + Singularity in phi direction at 0° (360°). Notes ----- @@ -262,13 +274,17 @@ def cskp( kcs Coordinate system type: - 0 or CART - Cartesian + 0 or CART + Cartesian - 1 or CYLIN - Cylindrical (circular or elliptical) + 1 or CYLIN + Cylindrical (circular or elliptical) - 2 or SPHE - Spherical (or spheroidal) + 2 or SPHE + Spherical (or spheroidal) - 3 or TORO - Toroidal + 3 or TORO + Toroidal porig Keypoint defining the origin of this coordinate system. If PORIG = @@ -349,13 +365,17 @@ def cswpla(self, kcn="", kcs="", par1="", par2="", **kwargs): kcs Coordinate system type: - 0 or CART - Cartesian + 0 or CART + Cartesian - 1 or CYLIN - Cylindrical (circular or elliptical) + 1 or CYLIN + Cylindrical (circular or elliptical) - 2 or SPHE - Spherical (or spheroidal) + 2 or SPHE + Spherical (or spheroidal) - 3 or TORO - Toroidal + 3 or TORO + Toroidal par1 Used for elliptical, spheroidal, or toroidal systems. If KCS = 1 @@ -397,17 +417,23 @@ def csys(self, kcn="", **kwargs): kcn Specifies the active coordinate system, as follows: - 0 (default) - Cartesian + 0 (default) + Cartesian - 1 - Cylindrical with global Cartesian Z as the axis of rotation + 1 + Cylindrical with global Cartesian Z as the axis of rotation - 2 - Spherical + 2 + Spherical - 4 or WP - Working Plane + 4 or WP + Working Plane - 5 - Cylindrical with global Cartesian Y as the axis of rotation + 5 + Cylindrical with global Cartesian Y as the axis of rotation - 11 or greater - Any previously defined local coordinate system + 11 or greater + Any previously defined local coordinate system Notes ----- @@ -487,13 +513,17 @@ def local( kcs Coordinate system type: - 0 or CART - Cartesian + 0 or CART + Cartesian - 1 or CYLIN - Cylindrical (circular or elliptical) + 1 or CYLIN + Cylindrical (circular or elliptical) - 2 or SPHE - Spherical (or spheroidal) + 2 or SPHE + Spherical (or spheroidal) - 3 or TORO - Toroidal + 3 or TORO + Toroidal xc, yc, zc Location (in the global Cartesian coordinate system) of the origin diff --git a/src/ansys/mapdl/core/_commands/database/picking.py b/src/ansys/mapdl/core/_commands/database/picking.py index 25fb6fd2a2..ccc4c8d612 100644 --- a/src/ansys/mapdl/core/_commands/database/picking.py +++ b/src/ansys/mapdl/core/_commands/database/picking.py @@ -95,35 +95,46 @@ def flst(self, nfield="", narg="", type_="", otype="", leng="", **kwargs): narg Number of items in the picked list. - type\_ + type\\_ Type of items picked: - 1 - Node numbers + 1 + Node numbers - 2 - Element numbers + 2 + Element numbers - 3 - Keypoint numbers + 3 + Keypoint numbers - 4 - Line numbers + 4 + Line numbers - 5 - Area numbers + 5 + Area numbers - 6 - Volume numbers + 6 + Volume numbers - 7 - Trace points + 7 + Trace points - 8 - Coordinate locations (in Global Cartesian coordinates) + 8 + Coordinate locations (in Global Cartesian coordinates) - 9 - Screen picks (in X, Y screen coordinates (-1 to 1)) + 9 + Screen picks (in X, Y screen coordinates (-1 to 1)) otype Data order: - NOOR - Data is not ordered (default). + NOOR + Data is not ordered (default). - ORDER - Data is in an ordered list (such as for the E,P51X and A,P51X commands, in - which the order of the data items is significant for the - picking operation). + ORDER + Data is in an ordered list (such as for the E,P51X and A,P51X commands, in + which the order of the data items is significant for the picking + operation). leng Length of number of items describing the list (should equal NARG if diff --git a/src/ansys/mapdl/core/_commands/database/selecting.py b/src/ansys/mapdl/core/_commands/database/selecting.py index 878b309d89..7593769d8e 100644 --- a/src/ansys/mapdl/core/_commands/database/selecting.py +++ b/src/ansys/mapdl/core/_commands/database/selecting.py @@ -40,28 +40,37 @@ def allsel(self, labt="", entity="", **kwargs): labt Type of selection to be made: - ALL - Selects all items of the specified entity type and all - items of lower entity types (default). + ALL + Selects all items of the specified entity type and all + items of lower entity types (default). - BELOW - Selects all items directly associated with and below - the selected items of the specified entity type. + BELOW + Selects all items directly associated with and below + the selected items of the specified entity type. entity Entity type on which selection is based: - ALL - All entity types (default). + ALL + All entity types (default). - VOLU - Volumes. + VOLU + Volumes. - AREA - Areas. + AREA + Areas. - LINE - Lines. + LINE + Lines. - KP - Keypoints. + KP + Keypoints. - ELEM - Elements. + ELEM + Elements. - NODE - Nodes. + NODE + Nodes. Notes ----- @@ -99,23 +108,29 @@ def asll(self, type_="", arkey="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of area select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. arkey Specifies whether all contained area lines must be selected [LSEL]: - 0 - Select area if any of its lines are in the selected line set. + 0 + Select area if any of its lines are in the selected line set. - 1 - Select area only if all of its lines are in the selected line set. + 1 + Select area only if all of its lines are in the selected line set. Notes ----- @@ -152,45 +167,56 @@ def asel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: - S - Select a new set (default) + S + Select a new set (default) - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. - ALL - Restore the full set. + ALL + Restore the full set. - NONE - Unselect the full set. + NONE + Unselect the full set. - INVE - Invert the current set (selected becomes unselected and vice versa). + INVE + Invert the current set (selected becomes unselected and vice versa). - STAT - Display the current select status. + STAT + Display the current select status. The following fields are used only with Type = S, R, A, or U: Item - Label identifying data. Valid item labels are shown in Table 105: ASEL - Valid Item and Component - Labels (p. 185). Some items also require a component label. If Item = PICK (or simply "P"), graphical - picking is enabled and all remaining command fields are ignored (valid only in the GUI). Defaults - to AREA. + Label identifying data. Valid item labels are shown in Table 105: + ASEL - Valid Item and Component Labels (p. 185). Some items also + require a component label. If Item = PICK (or simply "P"), graphical + picking is enabled and all remaining command fields are ignored + (valid only in the GUI). Defaults to AREA. Comp - Component of the item (if required). Valid component labels are shown in Table 105: ASEL - Valid - Item and Component Labels (p. 185). + Component of the item (if required). Valid component labels are + shown in Table 105: ASEL - Valid Item and Component Labels (p. 185). VMIN - Minimum value of item range. Ranges are area numbers, coordinate values, attribute numbers, etc., - as appropriate for the item. A component name (as specified on the CM (p. 338) command) may - also be substituted for VMIN (VMAX and VINC are ignored). If Item = MAT, TYPE, REAL, or ESYS - and if VMIN is positive, the absolute value of Item is compared against the range for selection; if - VMIN is negative, the signed value of Item is compared. See the ALIST (p. 106) command for a - discussion of signed attributes. + Minimum value of item range. Ranges are area numbers, coordinate + values, attribute numbers, etc., as appropriate for the item. A + component name (as specified on the CM (p. 338) command) may also be + substituted for VMIN (VMAX and VINC are ignored). If Item = MAT, + TYPE, REAL, or ESYS and if VMIN is positive, the absolute value of + Item is compared against the range for selection; if VMIN is + negative, the signed value of Item is compared. See the ALIST (p. + 106) command for a discussion of signed attributes. VMAX Maximum value of item range. VMAX defaults to VMIN. @@ -202,8 +228,10 @@ def asel( KSWP Specifies whether only areas are to be selected: - - `kswp = 0` - Select areas only. - - `kswp = 1` - Select areas, as well as keypoints, lines, nodes, and elements associated with selected areas. + - `kswp = 0` + Select areas only. + - `kswp = 1` + Select areas, as well as keypoints, lines, nodes, and elements associated with selected areas. Valid only with Type = S. @@ -272,16 +300,20 @@ def aslv(self, type_="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of area select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -306,18 +338,23 @@ def dofsel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: - S - Select a new set of labels. + S + Select a new set of labels. - A - Add labels to the current set. + A + Add labels to the current set. - U - Unselect (remove) labels from the current set. + U + Unselect (remove) labels from the current set. - ALL - Restore the full set of labels. + ALL + Restore the full set of labels. - STAT - Display the current select status. + STAT + Display the current select status. dof1, dof2, dof3, . . . , dof6 Used only with Type = S, A, or U. Valid structural labels: UX, @@ -393,18 +430,26 @@ def esel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: - - S - Select a new set (default). - - R - Reselect a set from the current set. - - A - Additionally select a set and extend the current set. - - U - Unselect a set from the current set. - - ALL - Restore the full set. - - NONE - Unselect the full set. - - INVE - Invert the current set (selected becomes - unselected and vice versa). - - STAT - Display the current select status. + S + Select a new set (default). + R + Reselect a set from the current set. + A + Additionally select a set and extend the current set. + U + Unselect a set from the current set. + ALL + Restore the full set. + NONE + Unselect the full set. + INVE + Invert the current set (selected becomes + unselected and vice versa). + STAT + Display the current select status. item Label identifying data, see Table 110: ESEL - Valid Item @@ -443,9 +488,12 @@ def esel( kabs Absolute value key: - - `kabs = 0` - Check sign of value during selection. - - `kabs = 1` - Use absolute value during selection (sign - ignored). + `kabs = 0` + Check sign of value during selection. + + `kabs = 1` + Use absolute value during selection (sign + ignored). Notes ----- @@ -532,13 +580,17 @@ def esla(self, type_: str = "", **kwargs) -> Optional[str]: type_ Label identifying the type of element select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -560,13 +612,17 @@ def esll(self, type_: str = "", **kwargs) -> Optional[str]: type_ Label identifying the type of element select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -590,41 +646,52 @@ def esln( type_ Label identifying the type of element selected: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. ekey Node set key: - 0 - Select element if any of its nodes are in the - selected nodal set (default). + 0 + Select element if any of its nodes are in the + selected nodal set (default). - 1 - Select element only if all of its nodes are in the - selected nodal set. + 1 + Select element only if all of its nodes are in the + selected nodal set. nodetype Label identifying type of nodes to consider when selecting: - ALL - Select elements considering all of their nodes ( - default). + ALL + Select elements considering all of their nodes ( + default). - ACTIVE - Select elements considering only their active - nodes. An active node is a node - that contributes DOFs to the model. + ACTIVE + Select elements considering only their active + nodes. An active node is a node + that contributes DOFs to the model. - INACTIVE - Select elements considering only their - inactive nodes (such as orientation or - radiation nodes). + INACTIVE + Select elements considering only their + inactive nodes (such as orientation or + radiation nodes). - CORNER - Select elements considering only their corner - nodes. + CORNER + Select elements considering only their corner + nodes. - MID - Select elements considering only their midside nodes. + MID + Select elements considering only their midside nodes. Notes ----- @@ -647,13 +714,17 @@ def eslv(self, type_: str = "", **kwargs) -> Optional[str]: type_ Label identifying the type of element selected: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -694,7 +765,7 @@ def ksel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: S @@ -750,8 +821,11 @@ def ksel( KABS Absolute value key: - - `kabs = 0` - Check sign of value during selection. - - `kabs = 1` - Use absolute value during selection (sign ignored). + `kabs = 0` + Check sign of value during selection. + + `kabs = 1` + Use absolute value during selection (sign ignored). Notes ----- @@ -808,16 +882,20 @@ def ksll(self, type_="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of keypoint select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -833,16 +911,20 @@ def ksln(self, type_="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of keypoint select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -883,24 +965,32 @@ def lsel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. - ALL - Restore the full set. + ALL + Restore the full set. - NONE - Unselect the full set. + NONE + Unselect the full set. - INVE - Invert the current set (selected becomes unselected and vice versa). + INVE + Invert the current set (selected becomes unselected and vice versa). - STAT - Display the current select status. + STAT + Display the current select status. The following fields are used only with Type = S, R, A, or U: @@ -938,9 +1028,12 @@ def lsel( KSWP Specifies whether only lines are to be selected: - - ``kswp=0`` - Select lines only. ``kswp=1`` - Select lines, - - as well as keypoints, nodes, and elements associated with - - selected lines. Valid only with ``type="s"``. + ``kswp=0`` + Select lines only. + + ``kswp=1`` + Select lines, as well as keypoints, nodes, and elements associated with + selected lines. Valid only with ``type="s"``. Notes ----- @@ -995,16 +1088,20 @@ def lsla(self, type_="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of line select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -1020,24 +1117,30 @@ def lslk(self, type_="", lskey="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of line select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. lskey Specifies whether all contained line keypoints must be selected [KSEL]: - 0 - Select line if any of its keypoints are in the selected keypoint set. + 0 + Select line if any of its keypoints are in the selected keypoint set. - 1 - Select line only if all of its keypoints are in the selected keypoint set. + 1 + Select line only if all of its keypoints are in the selected keypoint set. Notes ----- @@ -1074,24 +1177,32 @@ def nsel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. - ALL - Restore the full set. + ALL + Restore the full set. - NONE - Unselect the full set. + NONE + Unselect the full set. - INVE - Invert the current set (selected becomes unselected and vice versa). + INVE + Invert the current set (selected becomes unselected and vice versa). - STAT - Display the current select status. + STAT + Display the current select status. The following fields are used only with Type = S, R, A, or U: @@ -1235,23 +1346,29 @@ def nsla(self, type_="", nkey="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of node select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. nkey Specifies whether only interior area nodes are to be selected: - 0 - Select only nodes interior to selected areas. + 0 + Select only nodes interior to selected areas. - 1 - Select all nodes (interior to area, interior to lines, and at keypoints) + 1 + Select all nodes (interior to area, interior to lines, and at keypoints) associated with the selected areas. Notes @@ -1282,34 +1399,45 @@ def nsle(self, type_="", nodetype="", num="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of node select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. nodetype Label identifying type of nodes to consider when selecting: - ALL - Select all nodes of the selected elements (default). + ALL + Select all nodes of the selected elements (default). - ACTIVE - Select only the active nodes. An active node is a node that contributes DOFs to + ACTIVE + Select only the active nodes. An active node is a node that contributes DOFs to the model. - INACTIVE - Select only inactive nodes (such as orientation or radiation). + INACTIVE + Select only inactive nodes (such as orientation or radiation). - CORNER - Select only corner nodes. + CORNER + Select only corner nodes. - MID - Select only midside nodes. + MID + Select only midside nodes. - POS - Select nodes in position Num. + POS + Select nodes in position Num. - FACE - Select nodes on face Num. + FACE + Select nodes on face Num. num Position or face number for NodeType = POS or FACE. @@ -1345,16 +1473,20 @@ def nslk(self, type_="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of node select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. Notes ----- @@ -1374,23 +1506,29 @@ def nsll(self, type_="", nkey="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of node select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. nkey Specifies whether only interior line nodes are to be selected: - 0 - Select only nodes interior to selected lines. + 0 + Select only nodes interior to selected lines. - 1 - Select all nodes (interior to line and at keypoints) + 1 + Select all nodes (interior to line and at keypoints) associated with the selected lines. Notes @@ -1411,16 +1549,20 @@ def nslv(self, type_="", nkey="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of node select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. nkey Specifies whether only interior volume nodes are to be selected: @@ -1447,23 +1589,30 @@ def partsel(self, type_="", pmin="", pmax="", pinc="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying type of select. Because PARTSEL is a command macro, the label must be enclosed in single quotes. - 'S' - Select a new set (default). + 'S' + Select a new set (default). - 'R' - Reselect a set from the current set. + 'R' + Reselect a set from the current set. - 'A' - Additionally select a set and extend the current set. + 'A' + Additionally select a set and extend the current set. - 'U' - Unselect a set from the current set. + 'U' + Unselect a set from the current set. - 'ALL' - Select all parts. + 'ALL' + Select all parts. - 'NONE' - Unselect all parts. + 'NONE' + Unselect all parts. - 'INVE' - Invert the current selected set. + 'INVE' + Invert the current selected set. Notes ----- @@ -1536,24 +1685,32 @@ def vsel( Parameters ---------- - type\_ + type\\_ Label identifying the type of volume select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. - ALL - Restore the full set. + ALL + Restore the full set. - NONE - Unselect the full set. + NONE + Unselect the full set. - INVE - Invert the current set (selected becomes unselected and vice versa). + INVE + Invert the current set (selected becomes unselected and vice versa). - STAT - Display the current select status. + STAT + Display the current select status. item : str, optional Label identifying data. Valid item labels are shown in the table @@ -1583,10 +1740,12 @@ def vsel( kswp : int, optional Specifies whether only volumes are to be selected: - - ``kswp=0`` - Select volumes only. - - ``kswp=1`` - Select volumes, as well as keypoints, lines, areas, - nodes, and elements associated with selected volumes. Valid only - with Type = S. + ``kswp=0`` + Select volumes only. + ``kswp=1`` + Select volumes, as well as keypoints, lines, areas, + nodes, and elements associated with selected volumes. Valid only + with Type = S. Notes ----- @@ -1633,24 +1792,30 @@ def vsla(self, type_="", vlkey="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of volume select: - S - Select a new set (default). + S + Select a new set (default). - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. vlkey Specifies whether all contained volume areas must be selected [ASEL]: - 0 - Select volume if any of its areas are in the selected area set. + 0 + Select volume if any of its areas are in the selected area set. - 1 - Select volume only if all of its areas are in the selected area set. + 1 + Select volume only if all of its areas are in the selected area set. Notes ----- diff --git a/src/ansys/mapdl/core/_commands/database/setup.py b/src/ansys/mapdl/core/_commands/database/setup.py index 7f8b5064b3..3d47be41e8 100644 --- a/src/ansys/mapdl/core/_commands/database/setup.py +++ b/src/ansys/mapdl/core/_commands/database/setup.py @@ -47,11 +47,13 @@ def resume(self, fname="", ext="", nopar="", knoplot="", **kwargs): nopar Parameter resume key: - 0 - All data in the database, including the scalar + 0 + All data in the database, including the scalar parameters, are replaced with the data saved on File.DB (default). - 1 - All data in the database, except the scalar + 1 + All data in the database, except the scalar parameters, are replaced with the data saved on File.DB. @@ -299,21 +301,29 @@ def units( label Label to denote the system of units used in this job: - USER - User-defined system (default). + USER + User-defined system (default). - SI - International system (m, kg, s, K). + SI + International system (m, kg, s, K). - MKS - MKS system (m, kg, s, °C). + MKS + MKS system (m, kg, s, °C). - uMKS - μMKS system (μm, kg, s, °C). + uMKS + μMKS system (μm, kg, s, °C). - CGS - CGS system (cm, g, s, °C). + CGS + CGS system (cm, g, s, °C). - MPA - MPA system (mm, Mg, s, °C). + MPA + MPA system (mm, Mg, s, °C). - BFT - U. S. Customary system using feet (ft, slug, s, °F). + BFT + U. S. Customary system using feet (ft, slug, s, °F). - BIN - U. S. Customary system using inches (in, lbf*s2/in, s, °F). + BIN + U. S. Customary system using inches (in, lbf*s2/in, s, °F). Notes ----- diff --git a/src/ansys/mapdl/core/_commands/database/working_plane.py b/src/ansys/mapdl/core/_commands/database/working_plane.py index 9676822881..345e5844fb 100644 --- a/src/ansys/mapdl/core/_commands/database/working_plane.py +++ b/src/ansys/mapdl/core/_commands/database/working_plane.py @@ -443,30 +443,38 @@ def wpstyl( wpctyp Working plane coordinate system type: - 0 - Cartesian (default). If working plane tracking is on [CSYS,4], the updated + 0 + Cartesian (default). If working plane tracking is on [CSYS,4], the updated active coordinate system will also be Cartesian. - 1 - Polar. If working plane tracking is on, the updated active coordinate system + 1 + Polar. If working plane tracking is on, the updated active coordinate system will be cylindrical. - 2 - Polar. If working plane tracking is on, the updated active coordinate system + 2 + Polar. If working plane tracking is on, the updated active coordinate system will be spherical. grtype Grid type: - 0 - Grid and WP triad. + 0 + Grid and WP triad. - 1 - Grid only. + 1 + Grid only. - 2 - WP triad only (default). + 2 + WP triad only (default). wpvis Grid visibility: - 0 - Do not show GRTYPE entities (grid and/or triad) (default). + 0 + Do not show GRTYPE entities (grid and/or triad) (default). - 1 - Show GRTYPE entities. Cartesian working planes will be displayed with a + 1 + Show GRTYPE entities. Cartesian working planes will be displayed with a Cartesian grid, polar with a polar grid. snapang diff --git a/src/ansys/mapdl/core/_commands/display_/setup.py b/src/ansys/mapdl/core/_commands/display_/setup.py index b3aa5aab99..3c48c32f37 100644 --- a/src/ansys/mapdl/core/_commands/display_/setup.py +++ b/src/ansys/mapdl/core/_commands/display_/setup.py @@ -42,13 +42,16 @@ def cmap(self, fname="", ext="", kywrd="", ncntr="", **kwargs): kywrd Keyword indicating the disposition of the color map file. - (blank) - Loads existing color map file. + (blank) + Loads existing color map file. - CREATE - Starts the CMAP utility and modifies or creates - the specified file. + CREATE + Starts the CMAP utility and modifies or creates + the specified file. - SAVE - Writes the active color map to the specified file, - which can be imported into future sessions. + SAVE + Writes the active color map to the specified file, + which can be imported into future sessions. ncntr Number of contours to be defined. Default = 9 (even if an existing @@ -87,33 +90,39 @@ def devdisp(self, label="", key="", **kwargs): label Device function label: - BBOX - Disables display information sorting for PowerGraphics displays. When activated - (KEY = 1 or ON), model rotations and replots are performed - without recalculating edge and surface data. This will speed - up the rotation (especially for 2-D displays) of large - models, although the display information will not be - resolved as quickly (you will see a bounding box instead of - the model during dynamic rotations). The default is OFF (KEY - = 0). - - DITHER - Dithering. When turned on (default), dithering smooths transitions in color - intensity. Applies only to Z-buffered displays. - - FONT - Font selection for the ANSYS graphics window. When Label = FONT, the command - format is: /DEVDISP,FONT,KEY,Val1,Val2,Val3,VAL4,Val5,Val6, - where KEY determines the type of font being controlled, and - values 1 through 6 control various font parameters. Note - that these values are device specific; using the same - command input file [/INPUT] on different machines may yield - different results.The following KEY values determine the - font information that will be supplied to the appropriate - driver (e.g., Postscript, X11, Win32, JPEG, ...): - - KEY = 1 - The command controls the LEGEND (documentation column) font. - - KEY = 2 - The command controls the ENTITY (node and keypoint number) font. - - KEY = 3 - The command controls the ANNOTATION/GRAPH font. + BBOX + Disables display information sorting for PowerGraphics displays. When activated + (KEY = 1 or ON), model rotations and replots are performed + without recalculating edge and surface data. This will speed + up the rotation (especially for 2-D displays) of large + models, although the display information will not be + resolved as quickly (you will see a bounding box instead of + the model during dynamic rotations). The default is OFF (KEY + = 0). + + DITHER + Dithering. When turned on (default), dithering smooths transitions in color + intensity. Applies only to Z-buffered displays. + + FONT + Font selection for the ANSYS graphics window. When Label = FONT, the command + format is: /DEVDISP,FONT,KEY,Val1,Val2,Val3,VAL4,Val5,Val6, + where KEY determines the type of font being controlled, and + values 1 through 6 control various font parameters. Note + that these values are device specific; using the same + command input file [/INPUT] on different machines may yield + different results.The following KEY values determine the + font information that will be supplied to the appropriate + driver (e.g., Postscript, X11, Win32, JPEG, ...): + + KEY = 1 + The command controls the LEGEND (documentation column) font. + + KEY = 2 + The command controls the ENTITY (node and keypoint number) font. + + KEY = 3 + The command controls the ANNOTATION/GRAPH font. Linux: Values 1 through 4 are used to find a match in the X11 database of font strings. Values 1, 2, and 3 are character strings; value 4 is a nonzero integer: - Val1 @@ -201,11 +210,14 @@ def nocolor(self, key="", **kwargs): key Color key: - 0 - Color the displays. + 0 + Color the displays. - 1 - Do not color the displays. + 1 + Do not color the displays. - 2 - Do not shade the displays. + 2 + Do not shade the displays. """ command = f"NOCOLOR,{key}" return self.run(command, **kwargs) @@ -221,19 +233,25 @@ def showdisp(self, dname="", ncpl="", **kwargs): Valid driver name (see Getting Started with Graphics in the Basic Analysis Guide for details): - - Any linked terminal driver (such as X11, TEKTRONIX, etc.) + + Any linked terminal driver (such as X11, TEKTRONIX, etc.) - HPGL - Hewlett-Packard Graphics Language + HPGL + Hewlett-Packard Graphics Language - HPGL2 - Hewlett-Packard Graphics Language with enhanced - color. (See the HPGL command for options.) - Ignores the NCPL field. + HPGL2 + Hewlett-Packard Graphics Language with enhanced + color. (See the HPGL command for options.) + Ignores the NCPL field. - INTERLEAF - Interleaf ASCII Format, OPS Version 5.0 + INTERLEAF + Interleaf ASCII Format, OPS Version 5.0 - POSTSCRIPT - PostScript, Version 1.0 Minimally Conforming + POSTSCRIPT + PostScript, Version 1.0 Minimally Conforming - DUMP - ASCII Text Dump + DUMP + ASCII Text Dump ncpl Number of color planes (4 to 8). Default is device-dependent. diff --git a/src/ansys/mapdl/core/_commands/graphics_/annotation.py b/src/ansys/mapdl/core/_commands/graphics_/annotation.py index 8f2bf3052e..8ebf08a3ec 100644 --- a/src/ansys/mapdl/core/_commands/graphics_/annotation.py +++ b/src/ansys/mapdl/core/_commands/graphics_/annotation.py @@ -86,36 +86,48 @@ def annot(self, lab="", val1="", val2="", **kwargs): lab Annotation control key: - OFF - Turns off annotation for each subsequent display (default). + OFF + Turns off annotation for each subsequent display (default). - ON - Turns on annotation for each subsequent display. + ON + Turns on annotation for each subsequent display. - DELE - Deletes all annotation. + DELE + Deletes all annotation. - SAVE - Saves annotation on a file. Use VAL1 for file name (defaults to Jobname) and - VAL2 for the extension (defaults to ANO). + SAVE + Saves annotation on a file. Use VAL1 for file name (defaults to Jobname) and + VAL2 for the extension (defaults to ANO). - SCALE - Sets annotation scale factor (direct input only). Use VAL1 for value (0.1 to - 10.0) (defaults to 1.0). + SCALE + Sets annotation scale factor (direct input only). Use VAL1 for value (0.1 to + 10.0) (defaults to 1.0). - XORIG - Sets the annotation x origin (direct input only). Use VAL1 for value (-3.0 to - 3.0). + XORIG + Sets the annotation x origin (direct input only). Use VAL1 for value (-3.0 to + 3.0). - YORIG - Sets annotation y origin (direct input only). Use VAL1 for value (-3.0 to - 3.0). + YORIG + Sets annotation y origin (direct input only). Use VAL1 for value (-3.0 to + 3.0). - SNAP - Sets annotation snap (menu button input only). Use VAL1 for value (0.002 to - 0.2) (defaults to 0.002). + SNAP + Sets annotation snap (menu button input only). Use VAL1 for value (0.002 to + 0.2) (defaults to 0.002). - STAT - Displays current annotation status. + STAT + Displays current annotation status. - DEFA - Sets annotation specifications to the default values. + DEFA + Sets annotation specifications to the default values. - REFR - Redisplays annotation graphics. + REFR + Redisplays annotation graphics. - TMOD - Sets the annotation text mode. If VAL1 = 1, annotation text will be drawn in - scalable bitmap fonts (default). If VAL1 = 0, annotation - text will be drawn with stroke text. + TMOD + Sets the annotation text mode. If VAL1 = 1, annotation text will be drawn in + scalable bitmap fonts (default). If VAL1 = 0, annotation + text will be drawn with stroke text. val1 Value (or file name) as noted with label above. @@ -159,33 +171,45 @@ def anum(self, num="", type_="", xhot="", yhot="", **kwargs): number is available; ANSYS will substitute the lowest available number in place of any user-specified higher number. - type\_ + type\\_ Annotation internal type number. If TYPE = DELE, delete annotation NUM. - 1 - Text + 1 + Text - 2 - Block text (not available in GUI) + 2 + Block text (not available in GUI) - 3 - Dimensions + 3 + Dimensions - 4 - Lines + 4 + Lines - 5 - Rectangles + 5 + Rectangles - 6 - Circles + 6 + Circles - 7 - Polygons + 7 + Polygons - 8 - Arcs + 8 + Arcs - 9 - Wedges, pies + 9 + Wedges, pies - 11 - Symbols + 11 + Symbols - 12 - Arrows + 12 + Arrows - 13 - Bitmap + 13 + Bitmap xhot X hot spot (-1.0 < X < 2.0). Used for menu button item delete. @@ -290,44 +314,62 @@ def lspec(self, lcolor="", linstl="", xlnwid="", **kwargs): lcolor Line color: - 0 - Black + 0 + Black - 1 - Red-Magenta + 1 + Red-Magenta - 2 - Magenta + 2 + Magenta - 3 - Blue-Magenta + 3 + Blue-Magenta - 4 - Blue + 4 + Blue - 5 - Cyan-Blue + 5 + Cyan-Blue - 6 - Cyan + 6 + Cyan - 7 - Green-Cyan + 7 + Green-Cyan - 8 - Green + 8 + Green - 9 - Yellow-Green + 9 + Yellow-Green - 10 - Yellow + 10 + Yellow - 11 - Orange + 11 + Orange - 12 - Red + 12 + Red - 13 - Dark Gray + 13 + Dark Gray - 14 - Light Gray + 14 + Light Gray - 15 - White + 15 + White linstl Line style: - 0 - Solid line. + 0 + Solid line. - 1 - Dashed line. + 1 + Dashed line. xlnwid Line width multiplier (1.0 to 20.0). Defaults to 1.0. @@ -366,15 +408,20 @@ def lsymbol(self, x="", y="", symang="", symtyp="", symsiz="", keybmp="", **kwar symtyp Symbol type: - 1 - Arrow. + 1 + Arrow. - 2 - Tee. + 2 + Tee. - 3 - Circle. + 3 + Circle. - 4 - Triangle. + 4 + Triangle. - 5 - Star. + 5 + Star. symsiz Symbol size multiplier (0.1 to 20.0). Defaults to 1.0. @@ -568,51 +615,71 @@ def pspec(self, pcolor="", kfill="", kbordr="", **kwargs): pcolor Polygon color (0 PCOLOR 15): - 0 - Black. + 0 + Black. - 1 - Red-Magenta. + 1 + Red-Magenta. - 2 - Magenta. + 2 + Magenta. - 3 - Blue-Magenta. + 3 + Blue-Magenta. - 4 - Blue. + 4 + Blue. - 5 - Cyan-Blue. + 5 + Cyan-Blue. - 6 - Cyan. + 6 + Cyan. - 7 - Green-Cyan. + 7 + Green-Cyan. - 8 - Green. + 8 + Green. - 9 - Yellow-Green. + 9 + Yellow-Green. - 10 - Yellow. + 10 + Yellow. - 11 - Orange. + 11 + Orange. - 12 - Red. + 12 + Red. - 13 - Dark Gray. + 13 + Dark Gray. - 14 - Light Gray. + 14 + Light Gray. - 15 - White. + 15 + White. kfill Polygon fill key: - 0 - Hollow polygon. + 0 + Hollow polygon. - 1 - Filled polygon. + 1 + Filled polygon. kbordr Polygon border key: - 0 - No border. + 0 + No border. - 1 - Border. + 1 + Border. Notes ----- @@ -716,37 +783,53 @@ def tspec(self, tcolor="", tsize="", txthic="", pangle="", iangle="", **kwargs): tcolor Text color (0 TCOLOR 15): - 0 - Black. + 0 + Black. - 1 - Red-Magenta. + 1 + Red-Magenta. - 2 - Magenta. + 2 + Magenta. - 3 - Blue-Magenta. + 3 + Blue-Magenta. - 4 - Blue. + 4 + Blue. - 5 - Cyan-Blue. + 5 + Cyan-Blue. - 6 - Cyan. + 6 + Cyan. - 7 - Green-Cyan. + 7 + Green-Cyan. - 8 - Green. + 8 + Green. - 9 - Yellow-Green. + 9 + Yellow-Green. - 10 - Yellow. + 10 + Yellow. - 11 - Orange. + 11 + Orange. - 12 - Red. + 12 + Red. - 13 - Dark Gray. + 13 + Dark Gray. - 14 - Light Gray. + 14 + Light Gray. - 15 - White. + 15 + White. tsize Text size factor. @@ -754,13 +837,17 @@ def tspec(self, tcolor="", tsize="", txthic="", pangle="", iangle="", **kwargs): txthic Text thickness key: - 1 - normal. + 1 + normal. - 2 - twice as thick. + 2 + twice as thick. - 3 - three times as thick. + 3 + three times as thick. - 4 - four times as thick. + 4 + four times as thick. pangle Text path angle (0.0 < angle < 360.0). diff --git a/src/ansys/mapdl/core/_commands/graphics_/graphs.py b/src/ansys/mapdl/core/_commands/graphics_/graphs.py index 98fe904503..777d33825f 100644 --- a/src/ansys/mapdl/core/_commands/graphics_/graphs.py +++ b/src/ansys/mapdl/core/_commands/graphics_/graphs.py @@ -32,9 +32,11 @@ def axlab(self, axis="", lab="", **kwargs): axis Axis specifier: - X - Apply label to X axis. + X + Apply label to X axis. - Y - Apply label to Y axis. + Y + Apply label to Y axis. lab Axis label (user defined text up to 30 characters long). Leave @@ -57,13 +59,17 @@ def grid(self, key="", **kwargs): key Grid key: - 0 (OFF) - No grid. + 0 (OFF) + No grid. - 1 (ON) - Full grid (X and Y grid lines). + 1 (ON) + Full grid (X and Y grid lines). - 2 (X) - Partial grid (X grid lines only). + 2 (X) + Partial grid (X grid lines only). - 3 (Y) - Partial grid (Y grid lines only) + 3 (Y) + Partial grid (Y grid lines only) Notes ----- @@ -88,97 +94,123 @@ def gropt(self, lab="", key="", **kwargs): lab Apply display style as selected from the following labels: - AXDV - Axis division (tick) marks (defaults to KEY = ON). - - AXNM - Axis scale numbers (defaults to KEY = ON, which puts numbers at the back plane - of the graph). If KEY = FRONT, numbers are on the front - plane of the graph. - - AXNSC - Axis number size scale factor. Input the scale value for KEY (defaults to - 1.0). - - ASCAL - Automatic scaling of additional Y-axes for multi-curve [/GRTYP, 2 or 3] graphs - (defaults to KEY = ON). If KEY = OFF, use base Y-axis - scaling (see the /YRANGE command). - - LOGX - Log X scale (defaults to KEY = OFF (linear)). - - LOGY - Log Y scale (applies only to the base Y axis) (defaults to KEY = OFF (linear)). - - FILL - Color fill areas under curves (defaults to KEY = OFF). - - CGRID - Superimpose background grid [/GRID] over areas under filled curves (defaults to - KEY = OFF). - - DIG1 - Number of significant digits before decimal point for axis values. Input the - value for KEY (defaults to 4). - - DIG2 - Number of significant digits after decimal point for axis values. Input the - value for KEY (defaults to 3). - - VIEW - View key for graph displays (defaults to KEY = OFF, in which case the view is - (0,0,1) for 2-D graph displays or (1,2,3) for 3-D graph - displays). If KEY = ON, the view settings for graph - displays are the same as the view settings for the model. - - REVX - Plots the values on the X-axis in reverse order. - - REVY - Plots the values on the Y-axis in reverse order. - - DIVX - Determines the number of divisions (grid markers) that will be plotted on the X - axis. - - DIVY - Determines the number of divisions (grid markers) that will be plotted on the Y - axis. - - LTYP - Determines whether ANSYS generated (KEY = 1) or system derived (KEY = 0) fonts - will be used for the axis labels. - - CURL - Determines the position of the curve labels. If (KEY = 1), the curve label will - be plotted in the legend column, and the label will be - displayed in the same color as the curve. If (KEY = 0) the - curve labels will be plotted near the curve. (default). - - XAXO - When you use this label, the subsequent KEY value will determine an offset - amount from the default (along the bottom) location for the - X axis. If KEY = 1.0, a full offset occurs (the X axis is - moved to the top of the graph). If KEY = 0.5, the axis is - offset to the midpoint of the graph, and if KEY = 0 the axis - remains in the original position, along the bottom of the - graph. For any offset, a grey copy of the original axis - (containing the axis numbering) remains at the original - location. - - YAXO - When you use this label, the subsequent KEY value will determine an offset - amount from the default (along the left side of the graph) - location for the Y axis. If KEY = 1.0, a full offset occurs - (the Y axis is moved to the right side of the graph). If KEY - = 0.5, the axis is offset to the midpoint of the graph, and - if KEY = 0 the axis remains in the original position, along - the left side of the graph. For any offset, a gray copy of - the original axis (containing the axis numbering) remains at - the original location. + AXDV + Axis division (tick) marks (defaults to KEY = ON). + + AXNM + Axis scale numbers (defaults to KEY = ON, which puts numbers at the back plane + of the graph). If KEY = FRONT, numbers are on the front + plane of the graph. + + AXNSC + Axis number size scale factor. Input the scale value for KEY (defaults to + 1.0). + + ASCAL + Automatic scaling of additional Y-axes for multi-curve [/GRTYP, 2 or 3] graphs + (defaults to KEY = ON). If KEY = OFF, use base Y-axis + scaling (see the /YRANGE command). + + LOGX + Log X scale (defaults to KEY = OFF (linear)). + + LOGY + Log Y scale (applies only to the base Y axis) (defaults to KEY = OFF (linear)). + + FILL + Color fill areas under curves (defaults to KEY = OFF). + + CGRID + Superimpose background grid [/GRID] over areas under filled curves (defaults to + KEY = OFF). + + DIG1 + Number of significant digits before decimal point for axis values. Input the + value for KEY (defaults to 4). + + DIG2 + Number of significant digits after decimal point for axis values. Input the + value for KEY (defaults to 3). + + VIEW + View key for graph displays (defaults to KEY = OFF, in which case the view is + (0,0,1) for 2-D graph displays or (1,2,3) for 3-D graph + displays). If KEY = ON, the view settings for graph + displays are the same as the view settings for the model. + + REVX + Plots the values on the X-axis in reverse order. + + REVY + Plots the values on the Y-axis in reverse order. + + DIVX + Determines the number of divisions (grid markers) that will be plotted on the X + axis. + + DIVY + Determines the number of divisions (grid markers) that will be plotted on the Y + axis. + + LTYP + Determines whether ANSYS generated (KEY = 1) or system derived (KEY = 0) fonts + will be used for the axis labels. + + CURL + Determines the position of the curve labels. If (KEY = 1), the curve label will + be plotted in the legend column, and the label will be + displayed in the same color as the curve. If (KEY = 0) the + curve labels will be plotted near the curve. (default). + + XAXO + When you use this label, the subsequent KEY value will determine an offset + amount from the default (along the bottom) location for the + X axis. If KEY = 1.0, a full offset occurs (the X axis is + moved to the top of the graph). If KEY = 0.5, the axis is + offset to the midpoint of the graph, and if KEY = 0 the axis + remains in the original position, along the bottom of the + graph. For any offset, a grey copy of the original axis + (containing the axis numbering) remains at the original + location. + + YAXO + When you use this label, the subsequent KEY value will determine an offset + amount from the default (along the left side of the graph) + location for the Y axis. If KEY = 1.0, a full offset occurs + (the Y axis is moved to the right side of the graph). If KEY + = 0.5, the axis is offset to the midpoint of the graph, and + if KEY = 0 the axis remains in the original position, along + the left side of the graph. For any offset, a gray copy of + the original axis (containing the axis numbering) remains at + the original location. key Option values: - OFF (0) - Do not apply selected style. + OFF (0) + Do not apply selected style. - ON (1) - Apply selected style. + ON (1) + Apply selected style. - nnnn - If Lab is DIG1 or DIG2, input the number of digits. + nnnn + If Lab is DIG1 or DIG2, input the number of digits. - nn - If Lab is AXNSC, input the scale factor. + nn + If Lab is AXNSC, input the scale factor. - FRONT - If Lab is AXNM, FRONT may also be input. + FRONT + If Lab is AXNM, FRONT may also be input. - Ndiv - If Lab is DIVX or DIVY, determines the number of divisions (1-99) that will be - applied to the axis. + Ndiv + If Lab is DIVX or DIVY, determines the number of divisions (1-99) that will be + applied to the axis. - Kfont - If Lab is LTYP, Kfont is ON (1) or OFF(0). ON will use ANSYS generated fonts - for the axis labels, while OFF will use SYSTEM (Windows, - X-system, etc.) fonts. The default value is ON (ANSYS - fonts). + Kfont + If Lab is LTYP, Kfont is ON (1) or OFF(0). ON will use ANSYS generated fonts + for the axis labels, while OFF will use SYSTEM (Windows, + X-system, etc.) fonts. The default value is ON (ANSYS + fonts). Notes ----- @@ -208,12 +240,15 @@ def grtyp(self, kaxis="", **kwargs): kaxis Axis selection key: - 0 or 1 - Single Y-axis. Up to 10 curves scaled to a single Y-axis. + 0 or 1 + Single Y-axis. Up to 10 curves scaled to a single Y-axis. - 2 - Additional Y-axes (one for each curve) (3 curves maximum). Allows better + 2 + Additional Y-axes (one for each curve) (3 curves maximum). Allows better scaling of curves with widely differing numbering ranges. - 3 - Same as 2 but with additional Y-axis and curves projected out of the plane (6 + 3 + Same as 2 but with additional Y-axis and curves projected out of the plane (6 curves maximum). Allows clearer display with an isometric view. The default view when KAXIS = 3 is View,1,1,2,3. @@ -242,24 +277,32 @@ def gthk(self, label="", thick="", **kwargs): label Apply thicknesses as selected from the following labels: - AXIS - Modify thickness of ordinate and abscissa axes on graph displays. + AXIS + Modify thickness of ordinate and abscissa axes on graph displays. - GRID - Modify thickness of grid lines on graph displays. + GRID + Modify thickness of grid lines on graph displays. - CURVE - Modify thickness of curve lines (when no area fill [/GROPT]). + CURVE + Modify thickness of curve lines (when no area fill [/GROPT]). thick Thickness ratio (whole numbers only, from -1 to 10): - -1 - Do not draw the curve, but show only the markers specified by /GMARKER. + -1 + Do not draw the curve, but show only the markers specified by /GMARKER. - 0 or 1 - Thin lines. + 0 or 1 + Thin lines. - 2 - The default thickness. + 2 + The default thickness. - 3 - 1.5 times the default thickness. + 3 + 1.5 times the default thickness. - etc. - (up to 10) + etc. + (up to 10) Notes ----- diff --git a/src/ansys/mapdl/core/_commands/graphics_/labeling.py b/src/ansys/mapdl/core/_commands/graphics_/labeling.py index a691ab08ca..ff06e4bf16 100644 --- a/src/ansys/mapdl/core/_commands/graphics_/labeling.py +++ b/src/ansys/mapdl/core/_commands/graphics_/labeling.py @@ -81,11 +81,14 @@ def clabel(self, wn="", key="", **kwargs): key Labeling key: - 0 or 1 - Label contours with legend or color (default). + 0 or 1 + Label contours with legend or color (default). - -1 - No contour labeling. + -1 + No contour labeling. - N - Same as 1 except show alphabetic legend only on every Nth element. + N + Same as 1 except show alphabetic legend only on every Nth element. Notes ----- @@ -219,11 +222,14 @@ def gformat(self, ftype="", nwidth="", dsignf="", **kwargs): FORTRAN format types (G is the default if this field is left blank.) - G - Gxx.yy. xx and yy are described below. + G + Gxx.yy. xx and yy are described below. - F - Fxx.yy + F + Fxx.yy - E - Exx.yy + E + Exx.yy nwidth Total width (12 maximum) of the field (the xx in Ftype). Defaults @@ -333,84 +339,117 @@ def pbc(self, item="", key="", min_="", max_="", abs_="", **kwargs): item Label identifying the item: - U - Applied translational constraints (UX, UY, UZ). + U + Applied translational constraints (UX, UY, UZ). - ROT - Applied rotational constraints (ROTX, ROTY, ROTZ). + ROT + Applied rotational constraints (ROTX, ROTY, ROTZ). - TEMP - Applied temperatures (TEMP, TBOT, TE2, TE3, . . ., TTOP). + TEMP + Applied temperatures (TEMP, TBOT, TE2, TE3, . . ., TTOP). - PRES - Applied fluid pressures. + PRES + Applied fluid pressures. - V - Applied flow velocities (VX, VY, VZ). + V + Applied flow velocities (VX, VY, VZ). - VOLT - Applied voltages. + VOLT + Applied voltages. - MAG - Applied scalar magnetic potentials. + MAG + Applied scalar magnetic potentials. - A - Applied vector magnetic potentials. + A + Applied vector magnetic potentials. - CONC - Concentration. + CONC + Concentration. - CHRG - Applied electric charge. + CHRG + Applied electric charge. - F or FORC - Applied structural forces (FX, FY, FZ). + F or FORC + Applied structural forces (FX, FY, FZ). - M or MOME - Applied structural moments (MX, MY, MZ). + M or MOME + Applied structural moments (MX, MY, MZ). - HEAT - Applied heat flows (HEAT, HBOT, HE2, HE3, . . ., HTOP). + HEAT + Applied heat flows (HEAT, HBOT, HE2, HE3, . . ., HTOP). - FLOW - Applied fluid flow. + FLOW + Applied fluid flow. - AMPS - Applied current flow. + AMPS + Applied current flow. - FLUX - Applied magnetic flux. + FLUX + Applied magnetic flux. - CSG - Applied magnetic current segments. + CSG + Applied magnetic current segments. - RATE - Diffusion flow rate. + RATE + Diffusion flow rate. - MAST - Master degrees of freedom. + MAST + Master degrees of freedom. - CP - Coupled nodes. + CP + Coupled nodes. - CE - Nodes in constraint equations. + CE + Nodes in constraint equations. - NFOR - POST1 nodal forces. + NFOR + POST1 nodal forces. - NMOM - POST1 nodal moments + NMOM + POST1 nodal moments - RFOR - POST1 reaction forces. + RFOR + POST1 reaction forces. - RMOM - POST1 reaction moments (MX, MY, MZ). + RMOM + POST1 reaction moments (MX, MY, MZ). - PATH - Path geometry (undistorted) associated with the PATH command after a PDEF or - PVECT command has been issued. + PATH + Path geometry (undistorted) associated with the PATH command after a PDEF or + PVECT command has been issued. - ACEL - Global acceleration (ACELX, ACELY, ACELZ vector). + ACEL + Global acceleration (ACELX, ACELY, ACELZ vector). - OMEG - Global angular velocity (OMEGX, OMEGY, OMEGZ vector) and acceleration (DOMEGX, - DOMEGY, DOMEGZ vector). + OMEG + Global angular velocity (OMEGX, OMEGY, OMEGZ vector) and acceleration (DOMEGX, + DOMEGY, DOMEGZ vector). - WELD - Applied spotwelds (ANSYS LS-DYNA). + WELD + Applied spotwelds (ANSYS LS-DYNA). - ALL - Represents all appropriate labels. + ALL + Represents all appropriate labels. key Symbol key: - 0 - Do not show symbol. + 0 + Do not show symbol. - 1 - Show symbol. + 1 + Show symbol. - 2 - Plot value next to symbol. + 2 + Plot value next to symbol. - min\_ + min\\_ Minimum value in a range of values plotted on screen. - max\_ + max\\_ Maximum value in a range of values plotted on screen. - abs\_ + abs\\_ Absolute number. If KEY = 2 and ABS = 0, a number falling between the MIN and MAX is displayed. If ABS is not specified, it defaults to 0. If KEY = 2 and ABS = 1, an absolute value falling between @@ -481,36 +520,50 @@ def pbf(self, item="", key="", **kwargs): item Label identifying the item: - TEMP - Applied temperatures. + TEMP + Applied temperatures. - FLUE - Applied fluences. + FLUE + Applied fluences. - HGEN - Applied heat generation rates. + HGEN + Applied heat generation rates. - JS - Applied current density magnitude. + JS + Applied current density magnitude. - JSX - X-component of current density. + JSX + X-component of current density. - JSY - Y-component of current density. + JSY + Y-component of current density. - JSZ - Z-component of current density. + JSZ + Z-component of current density. - PHASE - Phase angle of applied load. + PHASE + Phase angle of applied load. - MVDI - Applied magnetic virtual displacements flag. + MVDI + Applied magnetic virtual displacements flag. - CHRGD - Applied electric charge density. + CHRGD + Applied electric charge density. - VLTG - Applied voltage drop. + VLTG + Applied voltage drop. key Symbol key: - 0 - Do not show body force load contours. + 0 + Do not show body force load contours. - 1 - Show body force load contours. + 1 + Show body force load contours. - 2 - Show current density as a vector (not a contour). + 2 + Show current density as a vector (not a contour). Notes ----- @@ -557,63 +610,79 @@ def plopts(self, label="", key="", **kwargs): label Apply display items as selected from the following labels: - INFO - Controls the display of the legend (ON or OFF) and allows the choice of preset - or Multi-legend placement. Control is provided by the KEY - values. (Defaults to KEY=3 when the GUI is on. Defaults to - KEY= 2 otherwise.) - - LEG1 - Header portion of legend column (defaults to ON). - - LEG2 - View portion of legend column (defaults to ON (except off with contour - displays)). - - LEG3 - View the contour section of the legend column (defaults to ON). - - FRAME - Frame border lines around windows (defaults to ON). - - TITLE - Title (bottom left text) (defaults to ON). - - MINM - Min-Max symbols on contour displays (defaults to ON). - - LOGO - ANSYS logo (defaults to OFF (displayed as text at top of legend column)). If - KEY = ON, the text is removed from legend column but the - logo symbol is displayed in whichever active window is - either in the uppermost right corner and on top, or if there - is no window in that location, then in the window to the - furthest right of the screen. Version information remains - in the legend column. - - WINS - Controls whether graphics windows automatically stretch or shrink to adjust to - screen size as the legend column is turned off or on - [/PLOPTS,INFO] (defaults to ON). If WINS is on and the - legend column is changed from off to on, all windows are - shrunk regardless of what their correct size is. - - WP - Working plane (defaults to OFF). The working plane is drawn as part of the - display (not just an overlaid image as in WPSTYL). This - option is best used in combination with a hidden-line - technique [/TYPE]. - - DATE - Controls the display of the date and time in your legend. Subsequent KEY values - control the display as follows: - - FILE - Controls the display of the ANSYS jobname in your legend. Subsequent KEY values - control the display as follows: + INFO + Controls the display of the legend (ON or OFF) and allows the choice of preset + or Multi-legend placement. Control is provided by the KEY + values. (Defaults to KEY=3 when the GUI is on. Defaults to + KEY= 2 otherwise.) + + LEG1 + Header portion of legend column (defaults to ON). + + LEG2 + View portion of legend column (defaults to ON (except off with contour + displays)). + + LEG3 + View the contour section of the legend column (defaults to ON). + + FRAME + Frame border lines around windows (defaults to ON). + + TITLE + Title (bottom left text) (defaults to ON). + + MINM + Min-Max symbols on contour displays (defaults to ON). + + LOGO + ANSYS logo (defaults to OFF (displayed as text at top of legend column)). If + KEY = ON, the text is removed from legend column but the + logo symbol is displayed in whichever active window is + either in the uppermost right corner and on top, or if there + is no window in that location, then in the window to the + furthest right of the screen. Version information remains + in the legend column. + + WINS + Controls whether graphics windows automatically stretch or shrink to adjust to + screen size as the legend column is turned off or on + [/PLOPTS,INFO] (defaults to ON). If WINS is on and the + legend column is changed from off to on, all windows are + shrunk regardless of what their correct size is. + + WP + Working plane (defaults to OFF). The working plane is drawn as part of the + display (not just an overlaid image as in WPSTYL). This + option is best used in combination with a hidden-line + technique [/TYPE]. + + DATE + Controls the display of the date and time in your legend. Subsequent KEY values + control the display as follows: + + FILE + Controls the display of the ANSYS jobname in your legend. Subsequent KEY values + control the display as follows: key Switch: - OFF or 0 - Do not apply this display item. For Label = DATE, no time or date are - displayed. + OFF or 0 + Do not apply this display item. For Label = DATE, no time or date are + displayed. - ON or 1 - Apply this display item. For Label = DATE, show only the date. + ON or 1 + Apply this display item. For Label = DATE, show only the date. - AUTO or 2 - For Label = INFO, initiate Auto-legend mode. If the display has contours, the - legend is ON; if the display has no contours, the - legend is OFF. For Label = DATE, display both the date - and time. + AUTO or 2 + For Label = INFO, initiate Auto-legend mode. If the display has contours, the + legend is ON; if the display has no contours, the + legend is OFF. For Label = DATE, display both the date + and time. - 3 - For Label = INFO , switch to Multi-legend mode. See the /UDOC command for the + 3 + For Label = INFO , switch to Multi-legend mode. See the /UDOC command for the available legend configurations. Notes @@ -647,52 +716,79 @@ def pnum(self, label="", key="", **kwargs): label Type of numbering/coloring: - NODE - Node numbers on node and element plots. + NODE + Node numbers on node and element plots. - ELEM - Element numbers and colors on element plots. + ELEM + Element numbers and colors on element plots. - SEC - Section numbers and colors on element and solid model plots (see "Notes"). + SEC + Section numbers and colors on element and solid model plots (see "Notes"). - MAT - Material set numbers and colors on element and solid model plots (see - "Notes"). + MAT + Material set numbers and colors on element and solid model plots (see + "Notes"). - TYPE - Element type reference numbers and colors on element and solid model plots (see - "Notes"). + TYPE + Element type reference numbers and colors on element and solid model plots (see + "Notes"). - REAL - Real constant set numbers and colors on element and solid model plots (see - "Notes"). + REAL + Real constant set numbers and colors on element and solid model plots (see + "Notes"). - ESYS - Element coordinate system numbers on element and solid model plots (see - "Notes"). + ESYS + Element coordinate system numbers on element and solid model plots (see + "Notes"). - PART - Element part numbers and colors on element plots (applicable to ANSYS LS-DYNA - only). + PART + Element part numbers and colors on element plots (applicable to ANSYS LS-DYNA + only). - LOC - Location numbers/colors of the element in matrix assembly order on element - plots. + LOC + Location numbers/colors of the element in matrix assembly order on element + plots. - Note:LOC and ELEM numbers will be the same unless the model has been reordered. - KP + .. note:: ``LOC`` and ``ELEM`` numbers will be the same unless the model has been reordered. - Keypoint numbers on solid model plots. - LINE + KP + Keypoint numbers on solid model plots. - Line numbers on solid model plots (both numbers and colors on line plots). - AREA + LINE + Line numbers on solid model plots (both numbers and colors on line plots). - Area numbers on solid model plots (both numbers and colors on area plots). - VOLU + AREA + Area numbers on solid model plots (both numbers and colors on area plots). - Volume numbers on solid model plots (both numbers and colors on volume plots). - SVAL + VOLU + Volume numbers on solid model plots (both numbers and colors on volume plots). - Stress (or any contour) values on postprocessing plots, and surface load values and colors on model plots (when surface load symbols are on [/PSF]). For tabular boundary conditions, the table-evaluated values will be displayed on node, element, or contour displays in POST1 when load symbols (/PBF, /PSF, /PBC) are on and TABNAM is OFF. - TABNAM + SVAL + Stress (or any contour) values on postprocessing plots, and + surface load values and colors on model plots (when surface load + symbols are on [/PSF]). For tabular boundary conditions, the + table-evaluated values will be displayed on node, element, or + contour displays in POST1 when load symbols (/PBF, /PSF, /PBC) + are on and TABNAM is OFF. - Table names for tabular boundary conditions. If this label is turned on, the table name appears next to the appropriate symbol, arrow, face outline, or contour as dictated by the /PSF, /PBC, and /PBF commands. - STAT + TABNAM + Table names for tabular boundary conditions. If this label is + turned on, the table name appears next to the appropriate + symbol, arrow, face outline, or contour as dictated by the /PSF, + /PBC, and /PBF commands. - Shows current settings for /PNUM. - DEFA + STAT + Shows current settings for /PNUM. - key + DEFA + key Switch: - 0 - Turns OFF numbers/colors for specified label. + 0 + Turns OFF numbers/colors for specified label. - 1 - Turns ON numbers/colors for specified label. + 1 + Turns ON numbers/colors for specified label. Notes ----- @@ -731,35 +827,43 @@ def psf(self, item="", comp="", key="", kshell="", color="", **kwargs): ---------- item, comp Labels identifying the surface load to be shown; see - Table 227: /PSF - Valid Item and Component Labels. + Table 227: /PSF Valid Item and Component Labels. key Key to turn surface load symbols on or off: - 0 - Off (default). + 0 + Off (default). - 1 - On, shown as face outlines. Line surface loads (SFL) on solid model plots are + 1 + On, shown as face outlines. Line surface loads (SFL) on solid model plots are shown as arrows. - 2 - On, shown as arrows. + 2 + On, shown as arrows. - 3 - On, shown as color filled surfaces. Line and area surface loads (SFL and SFA) + 3 + On, shown as color filled surfaces. Line and area surface loads (SFL and SFA) on solid model plots are shown as arrows. kshell Visibility key for shell elements. - 0 - Off (default), surface load symbols are displayed only on visible load faces. + 0 + Off (default), surface load symbols are displayed only on visible load faces. - 1 - On, surface load symbols are displayed even if load face is not visible. + 1 + On, surface load symbols are displayed even if load face is not visible. color Visibility key for contour legend. - ON - The symbols (arrows or face outlines) will show up in color with the legend + ON + The symbols (arrows or face outlines) will show up in color with the legend showing the corresponding color labels (default). - OFF - The contour legend will not be displayed. The symbols (arrows or face outlines) + OFF + The contour legend will not be displayed. The symbols (arrows or face outlines) will show up in grey. The size of the arrows will be proportional to the applied load. @@ -811,7 +915,8 @@ def psf(self, item="", comp="", key="", kshell="", color="", **kwargs): This command is valid in any processor. - Table: 227:: : /PSF - Valid Item and Component Labels + Table: 227:: : /PSF + Valid Item and Component Labels Pressure loads apply to the element coordinate system (KEYOPT(2) = 0). Adjust appropriately for a local coordinate system (KEYOPT(2) = 1). See @@ -840,76 +945,93 @@ def psymb(self, label="", key="", **kwargs): label Show symbols as selected from the following labels: - CS - Local coordinate systems. + CS + Local coordinate systems. - NDIR - Nodal coordinate systems (on rotated nodes only). + NDIR + Nodal coordinate systems (on rotated nodes only). - ESYS - Element coordinate systems (element displays only). + ESYS + Element coordinate systems (element displays only). - LDIR - Line directions (line displays only). + LDIR + Line directions (line displays only). - LDIV - Controls the display of element divisions on lines. + LDIV + Controls the display of element divisions on lines. - ADIR - Area direction symbol (for keypoint, line, area and volume plots). + ADIR + Area direction symbol (for keypoint, line, area and volume plots). - LAYR - Layer orientations (relative to the projected element x-axis) or fiber - orientations in smeared reinforcing elements. Used only - within an element display. Use KEY to specify the layer - number. + LAYR + Layer orientations (relative to the projected element x-axis) or fiber + orientations in smeared reinforcing elements. Used only + within an element display. Use KEY to specify the layer + number. - ECON - Element mesh symbols on keypoints and lines. + ECON + Element mesh symbols on keypoints and lines. - DOT - Larger symbols displayed for node and keypoint locations. When Label = DOT, - KEY = 1 by default. + DOT + Larger symbols displayed for node and keypoint locations. When Label = DOT, + KEY = 1 by default. - XNOD - Extra node of surface or circuit elements. + XNOD + Extra node of surface or circuit elements. - FBCS - Force boundary condition scaling. Subsequent KEY value determines whether or - not to scale the applied and derived forces/moments to the - same maximum value. + FBCS + Force boundary condition scaling. Subsequent KEY value determines whether or + not to scale the applied and derived forces/moments to the + same maximum value. - DEFA - Resets the symbol keys so that ANSYS displays none of the symbols controlled by - the /PSYMB command. The value of the KEY field is ignored. + DEFA + Resets the symbol keys so that ANSYS displays none of the symbols controlled by + the /PSYMB command. The value of the KEY field is ignored. - STAT - Prints the status of the settings of the symbol - keys controlled by the /PSYMB command. The KEY - field is ignored. + STAT + Prints the status of the settings of the symbol + keys controlled by the /PSYMB command. The KEY + field is ignored. key Symbol key: - ``-1`` - Effective only if Label = LAYR and solid shape - element display (/ESHAPE) is active. Orientation of - all layers appears with the solid shape element - display. - - 0 - No symbol (default). If Label = LDIV, then KEY= 0 - indicates that the displayed element divisions will - correspond to the existing mesh (the word MESHED or - EXISTING can also be substituted). Also, for Label = - LDIV, if you execute any meshing command (such as - AMESH or VMESH), KEY is set to 0 (MESHED) - automatically. If Label = FBCS, then KEY= 0 indicates - that boundary condition scaling will not be - common. The applied and derived forces/moments will - be scaled to their respective maximum values. - - 1 - Include symbol. If Label = LDIV, then KEY = 1 - indicates that the displayed line divisions will - correspond to the value assigned by LESIZE (the word - LESIZE can also be substituted). Also, for Label = - LDIV, if you execute the LESIZE command, KEY is set - to 1 (LESIZE) automatically. If Label = FBCS, then - KEY= 1 indicates that boundary condition scaling will - be common. The applied and derived forces/moments - will be scaled to the same maximum value. - - N - If Label = LAYR, then N is equal to the layer - number. If Label = DOT, then N can be equal to - 0,1,.....15, indicating the dot size. If Label = - LDIV, then KEY = -1, indicates that no element - divisions will be displayed (the word OFF can also be - substituted). + ``-1`` + Effective only if Label = LAYR and solid shape + element display (/ESHAPE) is active. Orientation of + all layers appears with the solid shape element + display. + + 0 + No symbol (default). If Label = LDIV, then KEY= 0 + indicates that the displayed element divisions will + correspond to the existing mesh (the word MESHED or + EXISTING can also be substituted). Also, for Label = + LDIV, if you execute any meshing command (such as + AMESH or VMESH), KEY is set to 0 (MESHED) + automatically. If Label = FBCS, then KEY= 0 indicates + that boundary condition scaling will not be + common. The applied and derived forces/moments will + be scaled to their respective maximum values. + + 1 + Include symbol. If Label = LDIV, then KEY = 1 + indicates that the displayed line divisions will + correspond to the value assigned by LESIZE (the word + LESIZE can also be substituted). Also, for Label = + LDIV, if you execute the LESIZE command, KEY is set + to 1 (LESIZE) automatically. If Label = FBCS, then + KEY= 1 indicates that boundary condition scaling will + be common. The applied and derived forces/moments + will be scaled to the same maximum value. + + N + If Label = LAYR, then N is equal to the layer + number. If Label = DOT, then N can be equal to + 0,1,.....15, indicating the dot size. If Label = + LDIV, then KEY = -1, indicates that no element + divisions will be displayed (the word OFF can also be + substituted). Notes ----- @@ -955,17 +1077,23 @@ def triad(self, lab="", **kwargs): lab Display triad as follows: - ORIG - Display triad at global origin (default). + ORIG + Display triad at global origin (default). - OFF - Turn off triad display. + OFF + Turn off triad display. - LBOT - Display triad in lower left screen corner. + LBOT + Display triad in lower left screen corner. - RBOT - Display triad in lower right screen corner. + RBOT + Display triad in lower right screen corner. - LTOP - Display triad in upper left screen corner. + LTOP + Display triad in upper left screen corner. - RTOP - Display triad in upper right screen corner. + RTOP + Display triad in upper right screen corner. Notes ----- @@ -997,57 +1125,70 @@ def udoc(self, wind="", cl_ass="", key="", **kwargs): class The type (and relative importance) of legend item being displayed: - CNTR - Contour legend. This legend item is controlled separately from the other legend - items (see note below). - - DATE - The items in the DATE class include the date and time, or the ANSYS graphical - logo (/PLOPTS,LOGO,1). This item is shown by default in all - plots. - - GWIN - The items in the GWIN class include the entity acronyms that appear in the - legend of a multiplot of entities (Nodes, Elements, - Keypoints, Lines, Areas, Volumes). GWIN items are shown by - default for all GPLOT displays. - - TYPE - Items in the TYPE class include the plot type (e.g. ELEMENTS, MATERIALS, NODAL - SOLUTIONS, etc.). TYPE items are shown by default in all - plots. - - TYP2 - Items in the TYP2 class include supplementary type information, such as DMAX - and SMAX for nodal solutions. TYP2 items are shown by - default in all plots. - - INUM - Items in the INUM class include the number labels generated by the /PNUM - command. This class is displayed by default in all plots - that contain /PNUM information. - - BCDC - The items in the BCDC class include labels created by the /PBC command. This - class is shown by default in all plots which contain /PBC - information. - - VECT - Items in the VECT class include labels created by the PLVECT command. This - class is shown by default for all PLVECT plots. - - SURF - The items in the SURF class include labels from the /PSF legend. This class is - shown by default on all plots of surface boundary - conditions. - - BODY - Items from the BODY class include labels from the /PBF legend. This class is - shown by default in all plots of body forces. - - PSTA - Items from the PSTA class include stress scaling statistics, such as the - /SSCALE setting. This class is not shown as the default for - any type of plot, and must be specifically referenced to - display the included data. - - VIEW - The items in the VIEW class include view statistics. This class is not shown as - the default for any type of plot, and must be specifically - referenced to display the included data. - - MISC - The items in the MISC class include supplementary labels like /EXPANDED and - Stress Section Cross Section. This class is not shown as the - default for any type of plot, and must be specifically - referenced to display the included data. + CNTR + Contour legend. This legend item is controlled separately from the other legend + items (see note below). + + DATE + The items in the DATE class include the date and time, or the ANSYS graphical + logo (/PLOPTS,LOGO,1). This item is shown by default in all + plots. + + GWIN + The items in the GWIN class include the entity acronyms that appear in the + legend of a multiplot of entities (Nodes, Elements, + Keypoints, Lines, Areas, Volumes). GWIN items are shown by + default for all GPLOT displays. + + TYPE + Items in the TYPE class include the plot type (e.g. ELEMENTS, MATERIALS, NODAL + SOLUTIONS, etc.). TYPE items are shown by default in all + plots. + + TYP2 + Items in the TYP2 class include supplementary type information, such as DMAX + and SMAX for nodal solutions. TYP2 items are shown by + default in all plots. + + INUM + Items in the INUM class include the number labels generated by the /PNUM + command. This class is displayed by default in all plots + that contain /PNUM information. + + BCDC + The items in the BCDC class include labels created by the /PBC command. This + class is shown by default in all plots which contain /PBC + information. + + VECT + Items in the VECT class include labels created by the PLVECT command. This + class is shown by default for all PLVECT plots. + + SURF + The items in the SURF class include labels from the /PSF legend. This class is + shown by default on all plots of surface boundary + conditions. + + BODY + Items from the BODY class include labels from the /PBF legend. This class is + shown by default in all plots of body forces. + + PSTA + Items from the PSTA class include stress scaling statistics, such as the + /SSCALE setting. This class is not shown as the default for + any type of plot, and must be specifically referenced to + display the included data. + + VIEW + The items in the VIEW class include view statistics. This class is not shown as + the default for any type of plot, and must be specifically + referenced to display the included data. + + MISC + The items in the MISC class include supplementary labels like /EXPANDED and + Stress Section Cross Section. This class is not shown as the + default for any type of plot, and must be specifically + referenced to display the included data. key Switch: diff --git a/src/ansys/mapdl/core/_commands/graphics_/scaling.py b/src/ansys/mapdl/core/_commands/graphics_/scaling.py index 86ef0f1d28..3759120d55 100644 --- a/src/ansys/mapdl/core/_commands/graphics_/scaling.py +++ b/src/ansys/mapdl/core/_commands/graphics_/scaling.py @@ -228,112 +228,155 @@ def txtre(self, lab="", num="", n1="", n2="", ninc="", **kwargs): lab You can apply texture according to the following labels: - ELEM - Apply texture to elements N1 through N2 in steps of NINC. - - AREA - Apply texture to areas N1 through N2 in steps of NINC. - - VOLU - Apply texture to volumes N1 through N2 in steps of NINC. - - CM - Apply texture to the component named in N1. N2 and - NINC are ignored. - - ON, OFF - Sets the specified texture display on or - off. All other fields are ignored. - - File - If Lab = File, the command format is /TXTRE, File, - Key_Index, Fname, Fext, --, Format (This variant of - the command is applicable to 2-D drivers). - - Key_Index - The texture index associated with the file. If - the number fifty-one (51) is used, the - imported bitmap will be used as the window's - logo. - - Fname - File name and directory path (248 characters - maximum, including the characters needed for the - directory path). An unspecified directory path - defaults to the working directory; in this case, - you can use all 248 characters for the file name. - - Fext - Filename extension (eight-character maximum). - - Format - The file format. If Format = 0, the file is a - pixmap (Linux) or Bitmap (PC). The file cannot - contain a compressed image, and the PC file must - be 8 or 24 bit BI_RGB format. If Format = 1 or - JPEG, then the file is in JPEG (Joint - Photographic Experts Group) format. If Format = 2 - or PNG, then the file is in PNG (Portable Network - Graphics) format. + ELEM + Apply texture to elements N1 through N2 in steps of NINC. + + AREA + Apply texture to areas N1 through N2 in steps of NINC. + + VOLU + Apply texture to volumes N1 through N2 in steps of NINC. + + CM + Apply texture to the component named in N1. N2 and + NINC are ignored. + + ON, OFF + Sets the specified texture display on or + off. All other fields are ignored. + + File + If Lab = File, the command format is /TXTRE, File, + Key_Index, Fname, Fext, --, Format (This variant of + the command is applicable to 2-D drivers). + + Key_Index + The texture index associated with the file. If + the number fifty-one (51) is used, the + imported bitmap will be used as the window's + logo. + + Fname + File name and directory path (248 characters + maximum, including the characters needed for the + directory path). An unspecified directory path + defaults to the working directory; in this case, + you can use all 248 characters for the file name. + + Fext + Filename extension (eight-character maximum). + + Format + The file format. If Format = 0, the file is a + pixmap (Linux) or Bitmap (PC). The file cannot + contain a compressed image, and the PC file must + be 8 or 24 bit BI_RGB format. If Format = 1 or + JPEG, then the file is in JPEG (Joint + Photographic Experts Group) format. If Format = 2 + or PNG, then the file is in PNG (Portable Network + Graphics) format. num Select the texture index number from the following list: - 0 - No Texturing + 0 + No Texturing - 1 - Aluminum + 1 + Aluminum - 2 - Aluminum, Brushed + 2 + Aluminum, Brushed - 3 - Steel With Bumps + 3 + Steel With Bumps - 4 - Steel, Embossed + 4 + Steel, Embossed - 5 - Iron + 5 + Iron - 6 - Steel, Pattern + 6 + Steel, Pattern - 7 - Steel, Riveted + 7 + Steel, Riveted - 8 - Steel, Scratched + 8 + Steel, Scratched - 9 - Tin + 9 + Tin - 10 - Metal + 10 + Metal - 11 - Steel, Etched + 11 + Steel, Etched - 12 - Metal, Hot + 12 + Metal, Hot - 13 - Iron, Grainy + 13 + Iron, Grainy - 14 - Metal, Rusty + 14 + Metal, Rusty - 15 - Brick + 15 + Brick - 16 - Block + 16 + Block - 17 - Wood + 17 + Wood - 18 - Wood, Light + 18 + Wood, Light - 19 - Wood, Walnut + 19 + Wood, Walnut - 20 - Plastic, Hard Blue + 20 + Plastic, Hard Blue - 21 - Plastic, Light Blue + 21 + Plastic, Light Blue - 22 - Plastic, Hard Red + 22 + Plastic, Hard Red - 31 - Gold + 31 + Gold - 32 - Brass + 32 + Brass - 33 - Silver + 33 + Silver - 34 - Plastic, Black + 34 + Plastic, Black - 35 - Plastic, Ivory + 35 + Plastic, Ivory - 36 - Plastic, Blue + 36 + Plastic, Blue - 37 - Plastic, Red + 37 + Plastic, Red - 38 - Plastic, Yellow + 38 + Plastic, Yellow - 39 - Plastic, Green + 39 + Plastic, Green - 40 - Plastic, Brown + 40 + Plastic, Brown n1, n2, ninc Apply texture to Lab items numbered N1 through N2 in steps of NINC @@ -385,9 +428,11 @@ def vscale(self, wn="", vratio="", key="", **kwargs): key Relative scaling key: - 0 - Use relative length scaling among vectors based on magnitudes. + 0 + Use relative length scaling among vectors based on magnitudes. - 1 - Use uniform length scaling for all vector lengths. + 1 + Use uniform length scaling for all vector lengths. Notes ----- diff --git a/src/ansys/mapdl/core/_commands/graphics_/style.py b/src/ansys/mapdl/core/_commands/graphics_/style.py index b49bcde26e..42279358be 100644 --- a/src/ansys/mapdl/core/_commands/graphics_/style.py +++ b/src/ansys/mapdl/core/_commands/graphics_/style.py @@ -449,7 +449,7 @@ def light(self, wn="", num="", int_="", xv="", yv="", zv="", refl="", **kwargs): 1 - Directional light. - int\_ + int\\_ Light intensity factor (defaults to 0.3 for ambient, 1.0 for directional). This option is valid only for 3-D devices). @@ -530,7 +530,7 @@ def shade(self, wn="", type_="", **kwargs): wn Window number (or ALL) to which command applies (defaults to 1). - type\_ + type\\_ Shading type: FACET or 0 - Facet shading (one color per area face) (default). diff --git a/src/ansys/mapdl/core/_commands/hidden.py b/src/ansys/mapdl/core/_commands/hidden.py index 71382dd191..dbbcd8c3d7 100644 --- a/src/ansys/mapdl/core/_commands/hidden.py +++ b/src/ansys/mapdl/core/_commands/hidden.py @@ -37,9 +37,11 @@ def _batch(self, lab="", **kwargs): lab Specifies listing mode during a batch run: - LIST - The batch output will include a listing of the input file. + LIST + The batch output will include a listing of the input file. - (blank) - Suppress input data listing. + (blank) + Suppress input data listing. Notes ----- @@ -86,9 +88,11 @@ def _output(self, fname="", ext="", loc="", **kwargs): loc Location within a file to which output will be written: - (blank) - Output is written starting at the top of the file (default). + (blank) + Output is written starting at the top of the file (default). - APPEND - Output is appended to the existing file. + APPEND + Output is appended to the existing file. Notes ----- diff --git a/src/ansys/mapdl/core/_commands/inq_func.py b/src/ansys/mapdl/core/_commands/inq_func.py index 45c9009601..359b6c6d94 100644 --- a/src/ansys/mapdl/core/_commands/inq_func.py +++ b/src/ansys/mapdl/core/_commands/inq_func.py @@ -153,7 +153,7 @@ def elmiqr(self, ielem, key, pname="__tmpvar__", **kwargs): * 1 - double precision * 2 - real * 3 - complex - * 4 - character\*8 + * 4 - character\\*8 * 7 - index * 19 - return virtual type of file. @@ -233,7 +233,7 @@ def kpinqr(self, knmi, key, pname="__tmpvar__", **kwargs): * 1 - double precision * 2 - real * 3 - complex - * 4 - character\*8 + * 4 - character\\*8 * 7 - index * 19 - return virtual type of file. @@ -501,7 +501,7 @@ def vlinqr(self, vnmi, key, pname="__tmpvar__", **kwargs): * -6, number of elements. * -7, pointer to volume in foreign db * -8, element shape. - * -9, (``section id``)\*10 + 2 + * -9, (``section id``)\\*10 + 2 * -10, element coordinate system. * -11, KZ2 - 2nd kpt for elem Z * -12, color and transparency packed @@ -750,7 +750,7 @@ def cpinqr(self, ncp, key, pname="__tmpvar__", **kwargs): * 5 - return number of values stored for ncp * 11 - return void percent (integer) * 16 - return location of next record - * \-1 - return master node for this eqn (this is currently only used by solution DB object) + * -1 - return master node for this eqn (this is currently only used by solution DB object) pname : str Name of the variable where the queried value is stored. diff --git a/src/ansys/mapdl/core/_commands/map_cmd.py b/src/ansys/mapdl/core/_commands/map_cmd.py index 9352fd218a..972b842f12 100644 --- a/src/ansys/mapdl/core/_commands/map_cmd.py +++ b/src/ansys/mapdl/core/_commands/map_cmd.py @@ -34,20 +34,26 @@ def ftype(self, filetype="", prestype="", **kwargs): Type of file from which the pressure data will be retrieved (no default): - CFXTBR - File from a CFX Transient Blade Row (TBR) analysis export. + CFXTBR + File from a CFX Transient Blade Row (TBR) analysis export. - CFDPOST - File from a CFD-Post BC Profile export. + CFDPOST + File from a CFD-Post BC Profile export. - FORMATTED - Formatted file. + FORMATTED + Formatted file. - CSV - Comma-Separated Values file. + CSV + Comma-Separated Values file. prestype Type of pressure data contained in the file: - 0 - Only real-valued pressures are on the file. + 0 + Only real-valued pressures are on the file. - 1 - Real-valued and imaginary-valued pressures are on the file (default). + 1 + Real-valued and imaginary-valued pressures are on the file (default). Notes ----- @@ -117,11 +123,14 @@ def plgeom(self, item="", nodekey="", **kwargs): item Items to plot: - BOTH - Plot both target and source geometries (default). + BOTH + Plot both target and source geometries (default). - TARGET - Plot only the target geometry. + TARGET + Plot only the target geometry. - SOURCE - Plot only the source geometry. + SOURCE + Plot only the source geometry. nodekey If the source data contains faces (that is, surface elements were @@ -148,11 +157,14 @@ def plmap(self, item="", nodekey="", imagkey="", **kwargs): item Items to plot: - BOTH - Plot both target and source pressures (default). + BOTH + Plot both target and source pressures (default). - TARGET - Plot only the target pressures. + TARGET + Plot only the target pressures. - SOURCE - Plot only the source pressures. + SOURCE + Plot only the source pressures. nodekey If the source data contains faces (that is, surface @@ -161,9 +173,11 @@ def plmap(self, item="", nodekey="", imagkey="", **kwargs): nodes and the elements. imagkey - 1 - Plot the real pressures (default). + 1 + Plot the real pressures (default). - 0 - Plot the imaginary pressures. + 0 + Plot the imaginary pressures. Notes ----- @@ -206,7 +220,7 @@ def read( while it is read. Default = 0. NSKIP is ignored for FileType = CFXTBR or CFDPOST on the FTYPE command. - format\_ + format\\_ For FileType = FORMATTED on the FTYPE command, Format is the read format in the FORTRAN FORMAT convention enclosed in parentheses; for example: (3e10.0,10x,e10.0,70x,e10.0) diff --git a/src/ansys/mapdl/core/_commands/post1_/animation.py b/src/ansys/mapdl/core/_commands/post1_/animation.py index bc4397b079..de3b6734aa 100644 --- a/src/ansys/mapdl/core/_commands/post1_/animation.py +++ b/src/ansys/mapdl/core/_commands/post1_/animation.py @@ -147,11 +147,11 @@ def andata( 2 - Range of results data. - min\_ + min\\_ The range minimum value. If left blank or 0, defaults to the first data point. - max\_ + max\\_ The range maximum value. If left blank or 0, defaults to the last data point. @@ -646,11 +646,11 @@ def anmres( delay Time delay during animation (default = 0.5 seconds). - min\_ + min\\_ Minimum results file number to animate. Default = 1 (for Jobname.RS01). - max\_ + max\\_ Maximum results file number to animate. Defaults to the highest numbered results file, Jobname.RSnn. @@ -743,11 +743,11 @@ def antime( 2 - Range of time data. - min\_ + min\\_ The range minimum value. If left blank defaults to the first data point. - max\_ + max\\_ The range maximum value. If left blank defaults to the last data point. diff --git a/src/ansys/mapdl/core/_commands/post1_/element_table.py b/src/ansys/mapdl/core/_commands/post1_/element_table.py index de1934b806..7a89f3be48 100644 --- a/src/ansys/mapdl/core/_commands/post1_/element_table.py +++ b/src/ansys/mapdl/core/_commands/post1_/element_table.py @@ -610,7 +610,7 @@ def sfact(self, type_="", **kwargs): Parameters ---------- - type\_ + type\\_ Type of calculation: 0 - No nodal safety factor or margin of safety calculations. @@ -658,7 +658,7 @@ def sfcalc(self, labr="", labs="", labt="", type_="", **kwargs): labt Labeled result item corresponding to the element temperature. - type\_ + type\\_ Type of calculation: 0 or 1 - Use safety factor (SF) calculation. diff --git a/src/ansys/mapdl/core/_commands/post1_/load_case.py b/src/ansys/mapdl/core/_commands/post1_/load_case.py index b2217a1640..d78398a600 100644 --- a/src/ansys/mapdl/core/_commands/post1_/load_case.py +++ b/src/ansys/mapdl/core/_commands/post1_/load_case.py @@ -36,9 +36,11 @@ def lcabs(self, lcno="", kabs="", **kwargs): kabs Absolute value key: - 0 - Use algebraic values of load case LCNO in operations. + 0 + Use algebraic values of load case LCNO in operations. - 1 - Use absolute values of load case LCNO in operations. + 1 + Use absolute values of load case LCNO in operations. Notes ----- @@ -91,9 +93,11 @@ def lcdef(self, lcno="", lstep="", sbstep="", kimg="", **kwargs): kimg Used only with results from complex analyses: - 0 - Use real part of complex solution + 0 + Use real part of complex solution - 1 - Use imaginary part. + 1 + Use imaginary part. Notes ----- @@ -183,31 +187,42 @@ def lcoper(self, oper="", lcase1="", oper2="", lcase2="", **kwargs): oper Valid operations are: - ZERO - Zero results portion of database (LCASE1 ignored). + ZERO + Zero results portion of database (LCASE1 ignored). - SQUA - Square database values (LCASE1 ignored). + SQUA + Square database values (LCASE1 ignored). - SQRT - Square root of database (absolute) values (LCASE1 ignored). + SQRT + Square root of database (absolute) values (LCASE1 ignored). - LPRIN - Recalculate line element principal stresses (LCASE1 ignored). Stresses are as - shown for the NMISC items of the ETABLE command for the - specific line element type. + LPRIN + Recalculate line element principal stresses (LCASE1 ignored). Stresses are as + shown for the NMISC items of the ETABLE command for the + specific line element type. - ADD - Add LCASE1 to database values. + ADD + Add LCASE1 to database values. - SUB - Subtract LCASE1 from database values. + SUB + Subtract LCASE1 from database values. - SRSS - Square root of the sum of the squares of database and LCASE1. + SRSS + Square root of the sum of the squares of database and LCASE1. - MIN - Compare and save in database the algebraic minimum of database and LCASE1. + MIN + Compare and save in database the algebraic minimum of database and LCASE1. - MAX - Compare and save in database the algebraic maximum of database and LCASE1. + MAX + Compare and save in database the algebraic maximum of database and LCASE1. - ABMN - Compare and save in database the absolute minimum of database and LCASE1 (based - on magnitudes, then apply the corresponding sign). + ABMN + Compare and save in database the absolute minimum of database and LCASE1 (based + on magnitudes, then apply the corresponding sign). - ABMX - Compare and save in database the absolute maximum of database and LCASE1 (based - on magnitudes, then apply the corresponding sign). + ABMX + Compare and save in database the absolute maximum of database and LCASE1 (based + on magnitudes, then apply the corresponding sign). lcase1 First load case in the operation (if any). See LCNO of the LCDEF @@ -217,18 +232,20 @@ def lcoper(self, oper="", lcase1="", oper2="", lcase2="", **kwargs): oper2 Valid operations are: - MULT - Multiplication: ``LCASE1*LCASE2`` - - CPXMAX - This option does a phase angle sweep to calculate the maximum of derived - stresses and equivalent strain for a complex solution - where LCASE1 is the real part and LCASE2 is the imaginary - part. The Oper field is not applicable with this option. - Also, the LCABS and SUMTYPE commands have no effect on - this option. The value of S3 will be a minimum. This - option does not apply to derived displacement amplitude - (USUM). Load case writing (LCWRITE) is not supported. See - POST1 and POST26 – Complex Results Postprocessing in the - Mechanical APDL Theory Reference for more information. + MULT + Multiplication: ``LCASE1*LCASE2`` + + CPXMAX + This option does a phase angle sweep to calculate the maximum of derived + stresses and equivalent strain for a complex solution + where LCASE1 is the real part and LCASE2 is the imaginary + part. The Oper field is not applicable with this option. + Also, the LCABS and SUMTYPE commands have no effect on + this option. The value of S3 will be a minimum. This + option does not apply to derived displacement amplitude + (USUM). Load case writing (LCWRITE) is not supported. See + POST1 and POST26 – Complex Results Postprocessing in the + Mechanical APDL Theory Reference for more information. lcase2 Second load case. Used only with Oper2 operations. @@ -272,24 +289,32 @@ def lcsel(self, type_="", lcmin="", lcmax="", lcinc="", **kwargs): Parameters ---------- - type\_ + type\\_ Label identifying the type of select: - S - Select a new set. + S + Select a new set. - R - Reselect a set from the current set. + R + Reselect a set from the current set. - A - Additionally select a set and extend the current set. + A + Additionally select a set and extend the current set. - U - Unselect a set from the current set. + U + Unselect a set from the current set. - ALL - Restore the full set. + ALL + Restore the full set. - NONE - Unselect the full set. + NONE + Unselect the full set. - INVE - Invert the current set (selected becomes unselected and vice versa). + INVE + Invert the current set (selected becomes unselected and vice versa). - STAT - Display the current select status. + STAT + Display the current select status. lcmin Minimum value of load case pointer range. @@ -324,9 +349,11 @@ def lcsum(self, lab="", **kwargs): lab Combination option - (blank) - Only combine summable items [default]. + (blank) + Only combine summable items [default]. - ALL - Combine all items including non summable items. + ALL + Combine all items including non summable items. Notes ----- diff --git a/src/ansys/mapdl/core/_commands/post1_/path_operations.py b/src/ansys/mapdl/core/_commands/post1_/path_operations.py index 066e9fff46..3e6d22a1a3 100644 --- a/src/ansys/mapdl/core/_commands/post1_/path_operations.py +++ b/src/ansys/mapdl/core/_commands/post1_/path_operations.py @@ -906,7 +906,7 @@ def psel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: S - Select a new path. diff --git a/src/ansys/mapdl/core/_commands/post1_/results.py b/src/ansys/mapdl/core/_commands/post1_/results.py index 8738a9374c..858a28b55a 100644 --- a/src/ansys/mapdl/core/_commands/post1_/results.py +++ b/src/ansys/mapdl/core/_commands/post1_/results.py @@ -118,7 +118,7 @@ def plcint(self, action="", id_="", node="", cont="", dtype="", **kwargs): FRONT - Plots CINT quantities distribution along the crack front. - id\_ + id\\_ Crack ID number. node @@ -558,7 +558,7 @@ def prcint(self, id_="", node="", dtype="", **kwargs): Parameters ---------- - id\_ + id\\_ Crack ID number. node diff --git a/src/ansys/mapdl/core/_commands/post1_/special.py b/src/ansys/mapdl/core/_commands/post1_/special.py index b29b02f879..4b243c1fd3 100644 --- a/src/ansys/mapdl/core/_commands/post1_/special.py +++ b/src/ansys/mapdl/core/_commands/post1_/special.py @@ -409,7 +409,7 @@ def cycphase(self, type_="", option="", **kwargs): Parameters ---------- - type\_ + type\\_ The type of operation requested: DISP - Calculate the maximum and minimum possible displacement at each node in the diff --git a/src/ansys/mapdl/core/_commands/post1_/surface_operations.py b/src/ansys/mapdl/core/_commands/post1_/surface_operations.py index eab8708d22..5f62625e2d 100644 --- a/src/ansys/mapdl/core/_commands/post1_/surface_operations.py +++ b/src/ansys/mapdl/core/_commands/post1_/surface_operations.py @@ -439,7 +439,7 @@ def susel( Parameters ---------- - type\_ + type\\_ Label identifying the type of select: S - Selects a new set (default). diff --git a/src/ansys/mapdl/core/_commands/post26_/setup.py b/src/ansys/mapdl/core/_commands/post26_/setup.py index a41b58b05c..ba7327e154 100644 --- a/src/ansys/mapdl/core/_commands/post26_/setup.py +++ b/src/ansys/mapdl/core/_commands/post26_/setup.py @@ -144,7 +144,7 @@ def cisol(self, n="", id_="", node="", cont="", dtype="", **kwargs): Arbitrary reference number or name assigned to this variable. Number must be >1 but int: Number assigned to the new keypoint. Defaults to the lowest available keypoint number. - type\_ + type\\_ Type of input for VALUE. RATIO - Value is the ratio of the distances between keypoints as follows: @@ -159,7 +159,7 @@ def kcenter( Parameters ---------- - type\_ + type\\_ Type of entity used to define the circular arc. The meaning of VAL1 through VAL4 will vary depending on Type. diff --git a/src/ansys/mapdl/core/_commands/preproc/meshing.py b/src/ansys/mapdl/core/_commands/preproc/meshing.py index b5fae60f6d..2f7090c5b9 100644 --- a/src/ansys/mapdl/core/_commands/preproc/meshing.py +++ b/src/ansys/mapdl/core/_commands/preproc/meshing.py @@ -1005,7 +1005,7 @@ def katt(self, mat="", real="", type_="", esys="", **kwargs): Parameters ---------- - mat, real, type\_, esys + mat, real, type\\_, esys Material number, real constant set number, type number, and coordinate system number to be associated with selected, unmeshed keypoints. @@ -1269,7 +1269,7 @@ def latt(self, mat="", real="", type_="", kb="", ke="", secnum="", **kwargs): Parameters ---------- - mat, real, type\_ + mat, real, type\\_ Material number, real constant set number, and type number to be associated with selected, unmeshed lines. @@ -2770,7 +2770,7 @@ def vatt(self, mat="", real="", type_="", esys="", secnum="", **kwargs): Parameters ---------- - mat, real, type\_, esys, secnum + mat, real, type\\_, esys, secnum Material number, real constant set number, type number, coordinate system number, and section number to be associated with selected, unmeshed volumes. diff --git a/src/ansys/mapdl/core/_commands/preproc/sections.py b/src/ansys/mapdl/core/_commands/preproc/sections.py index 67762a0929..8c57479ea0 100644 --- a/src/ansys/mapdl/core/_commands/preproc/sections.py +++ b/src/ansys/mapdl/core/_commands/preproc/sections.py @@ -1082,7 +1082,7 @@ def sectype(self, secid="", type_="", subtype="", name="", refinekey="", **kwarg secid Section identification number. - type\_ + type\\_ BEAM BEAM - Defines a beam section. @@ -1298,7 +1298,7 @@ def slist(self, sfirst="", slast="", sinc="", details="", type_="", **kwargs): GROUP - If a section calls other sections, this option lists those sections too. - type\_ + type\\_ The section type. Valid arguments are ALL (the default) and the types available on the SECTYPE command. diff --git a/src/ansys/mapdl/core/_commands/reduced/generation.py b/src/ansys/mapdl/core/_commands/reduced/generation.py index 4399396f12..20351a729f 100644 --- a/src/ansys/mapdl/core/_commands/reduced/generation.py +++ b/src/ansys/mapdl/core/_commands/reduced/generation.py @@ -186,10 +186,10 @@ def rmmrange( DOMINANT - Dominant mode - min\_ + min\\_ Lower bound for fit range of mode. - max\_ + max\\_ Upper bound for fit range of mode. nstep @@ -339,7 +339,7 @@ def rmroptions(self, refname="", type_="", invert="", **kwargs): capacitance reference name previously defined by means of RMCAP command for the electrostatic domain. - type\_ + type\\_ Type of fitting function to be applied for regression analysis. Valid types are: @@ -376,7 +376,7 @@ def rmrplot(self, refname="", type_="", mode1="", mode2="", **kwargs): definition, previously defined by means of the RMCAP command, for the electrostatic domain. - type\_ + type\\_ Type of data to be plotted. Valid types are: FUNC - Response surface (default) diff --git a/src/ansys/mapdl/core/_commands/solution/analysis_options.py b/src/ansys/mapdl/core/_commands/solution/analysis_options.py index aca4d1b313..a5aad3cb64 100644 --- a/src/ansys/mapdl/core/_commands/solution/analysis_options.py +++ b/src/ansys/mapdl/core/_commands/solution/analysis_options.py @@ -2619,7 +2619,7 @@ def ovcheck(self, method="", frequency="", set_="", **kwargs): LOADSTEP - At the beginning of each load step. - set\_ + set\\_ Set of equations: All - Check for overconstraint between all constraint equations (default). @@ -2781,7 +2781,7 @@ def perturb(self, type_="", matkey="", contkey="", loadcontrol="", **kwargs): Parameters ---------- - type\_ + type\\_ Type of linear perturbation analysis to be performed: STATIC - Perform a linear perturbation static analysis. diff --git a/src/ansys/mapdl/core/_commands/solution/dynamic_options.py b/src/ansys/mapdl/core/_commands/solution/dynamic_options.py index 40e3d98036..6e991e3a50 100644 --- a/src/ansys/mapdl/core/_commands/solution/dynamic_options.py +++ b/src/ansys/mapdl/core/_commands/solution/dynamic_options.py @@ -137,10 +137,11 @@ def frqscl(self, scaling="", **kwargs): ---------- scaling + Off + Do not use automatic scaling of the mass matrix and frequency range. - Off - Do not use automatic scaling of the mass matrix and frequency range. - - On - Use automatic scaling of the mass matrix and frequency range. + On + Use automatic scaling of the mass matrix and frequency range. Notes ----- @@ -206,19 +207,26 @@ def harfrq(self, freqb="", freqe="", logopt="", freqarr="", toler="", **kwargs): frequency or beginning frequency is used for NSBSTP = 1. Valid values are: - OB1 - Octave band. + OB1 + Octave band. - OB2 - 1/2 octave band. + OB2 + 1/2 octave band. - OB3 - 1/3 octave band. + OB3 + 1/3 octave band. - OB6 - 1/6 octave band. + OB6 + 1/6 octave band. - OB12 - 1/12 octave band. + OB12 + 1/12 octave band. - OB24 - 1/24 octave band. + OB24 + 1/24 octave band. - LOG - General logarithm frequency span. + LOG + General logarithm frequency span. freqarr An array containing frequency values (Hz). Combined with the @@ -296,22 +304,25 @@ def hrocean(self, type_="", nphase="", **kwargs): Parameters ---------- - type\_ + type\\_ Specifies how to include ocean wave information in a harmonic analysis: - HARMONIC - Performs a harmonic analysis using both real and imaginary load vectors - calculated via the harmonic ocean wave procedure (HOWP). - This behavior is the default. This option performs a - harmonic analysis running at a frequency determined by - the wave period (specified via OCTABLE command input). + HARMONIC + Performs a harmonic analysis using both real and imaginary load vectors + calculated via the harmonic ocean wave procedure (HOWP). + This behavior is the default. This option performs a + harmonic analysis running at a frequency determined by + the wave period (specified via OCTABLE command input). - STATIC - Performs a static analysis using both real and imaginary load vectors - (calculated via HOWP). This option works by performing a - harmonic analysis running at a frequency of 0.0. + STATIC + Performs a static analysis using both real and imaginary load vectors + (calculated via HOWP). This option works by performing a + harmonic analysis running at a frequency of 0.0. - OFF - Deactivates a previously activated HOWP and performs a standard harmonic - analysis. + OFF + Deactivates a previously activated HOWP and performs a standard harmonic + analysis. nphase Positive number specifying the number of phases to calculate @@ -367,20 +378,26 @@ def hropt(self, method="", maxmode="", minmode="", mcout="", damp="", **kwargs): method Solution method for the harmonic analysis: - AUTO - Automatically select the most efficient method. Either the FULL method or the - Variational Technology method is selected depending on the - model. (default method). + AUTO + Automatically select the most efficient method. Either the FULL method or the + Variational Technology method is selected depending on the + model. (default method). - FULL - Full method. + FULL + Full method. - MSUP - Mode-superposition method. + MSUP + Mode-superposition method. - VT - Variational Technology method (based on FULL harmonic algorithm). + VT + Variational Technology method (based on FULL harmonic algorithm). - VTPA - Variational Technology perfect absorber method (based on FULL harmonic - algorithm). + VTPA + Variational Technology perfect absorber method (based on FULL harmonic + algorithm). - VTRU - Variational Technology reuse method (based on FULL harmonic algorithm). + VTRU + Variational Technology reuse method (based on FULL harmonic algorithm). maxmode Largest mode number to be used to calculate the response (for @@ -395,17 +412,21 @@ def hropt(self, method="", maxmode="", minmode="", mcout="", damp="", **kwargs): Modal coordinates output key (valid only for the mode superposition method MSUP): - NO - No output of modal coordinates (default). + NO + No output of modal coordinates (default). - YES - Output modal coordinates to the text file jobname.MCF. + YES + Output modal coordinates to the text file jobname.MCF. damp Damping mode for frequency-dependent material properties (valid only for the Variational Technology Method VT). - Hysteretic - Not proportional to the frequency. + Hysteretic + Not proportional to the frequency. - Viscous - Proportional to the frequency (default). + Viscous + Proportional to the frequency (default). Notes ----- @@ -437,23 +458,29 @@ def hrout(self, reimky="", clust="", mcont="", **kwargs): reimky Real/Imaginary print key: - ON - Print complex displacements as real and imaginary components (default). + ON + Print complex displacements as real and imaginary components (default). - OFF - Print complex displacements as amplitude and phase angle (degrees). + OFF + Print complex displacements as amplitude and phase angle (degrees). clust Cluster option (for HROPT,MSUP): - OFF - Uniform spacing of frequency solutions (default). + OFF + Uniform spacing of frequency solutions (default). - ON - Cluster frequency solutions about natural frequencies. + ON + Cluster frequency solutions about natural frequencies. mcont Mode contributions key (for HROPT,MSUP): - OFF - No print of mode contributions at each frequency (default). + OFF + No print of mode contributions at each frequency (default). - ON - Print mode contributions at each frequency. + ON + Print mode contributions at each frequency. Notes ----- @@ -597,13 +624,17 @@ def mdplot(self, function="", dmpname="", scale="", **kwargs): function Function to display. - d_coeff - Damping coefficient + d_coeff + Damping coefficient - s_coeff - Squeeze coefficient + s_coeff + Squeeze coefficient - d_ratio - Damping ratio + d_ratio + Damping ratio - s_ratio - Squeeze stiffness ratio + s_ratio + Squeeze stiffness ratio dmpname Array parameter name where damping information is stored. Defaults @@ -612,9 +643,11 @@ def mdplot(self, function="", dmpname="", scale="", **kwargs): scale Indicates whether to perform a linear or a double logarithmic plot. - LIN - Perform a linear plot. Default + LIN + Perform a linear plot. Default - LOG - Perform a double logarithmic plot. + LOG + Perform a double logarithmic plot. Notes ----- @@ -634,12 +667,15 @@ def midtol(self, key="", tolerb="", resfq="", **kwargs): key Midstep residual criterion activation key. - ON or 1 - Activate midstep residual criterion in a structural transient analysis - (default). + ON or 1 + Activate midstep residual criterion in a structural transient analysis + (default). - OFF or 0 - Deactivate midstep residual criterion in a structural transient analysis. + OFF or 0 + Deactivate midstep residual criterion in a structural transient analysis. - STAT - List the current midstep residual criterion setting. + STAT + List the current midstep residual criterion setting. tolerb Midstep residual tolerance or reference value for bisection. @@ -649,10 +685,12 @@ def midtol(self, key="", tolerb="", resfq="", **kwargs): Key to use response frequency computation along with midstep residual criterion for automatic time stepping (AUTOTS,ON). - OFF or 0 - Do not calculate response frequency and do not consider it in the automatic - time stepping (default). + OFF or 0 + Do not calculate response frequency and do not consider it in the automatic + time stepping (default). - ON or 1 - Calculate response frequency and consider it in the automatic time stepping. + ON or 1 + Calculate response frequency and consider it in the automatic time stepping. Notes ----- @@ -691,21 +729,25 @@ def modcont(self, mlskey="", enforcedkey="", **kwargs): mlskey Multiple load step key: - OFF - Perform the modal analysis (compute the eigenvalues and the load vector) for - each load step. (default) + OFF + Perform the modal analysis (compute the eigenvalues and the load vector) for + each load step. (default) - ON - Perform the modal analysis (compute the eigenvalues and the load vector) only - for the first load step; form the load vector for each - subsequent load step (without repeating the eigenvalue - calculations) and write all load vectors to the Jobname.MODE - file for downstream mode-superposition analyses. + ON + Perform the modal analysis (compute the eigenvalues and the load vector) only + for the first load step; form the load vector for each + subsequent load step (without repeating the eigenvalue + calculations) and write all load vectors to the Jobname.MODE + file for downstream mode-superposition analyses. enforcedkey Enforced motion key: - OFF - Do not calculate enforced static modes. (default) + OFF + Do not calculate enforced static modes. (default) - ON - Calculate enforced static modes and write them to the Jobname.MODE file. + ON + Calculate enforced static modes and write them to the Jobname.MODE file. Notes ----- @@ -801,21 +843,29 @@ def modopt( method Mode-extraction method to be used for the modal analysis. - LANB - Block Lanczos + LANB + Block Lanczos - LANPCG - PCG Lanczos + LANPCG + PCG Lanczos - SNODE - Supernode modal solver + SNODE + Supernode modal solver - SUBSP - Subspace algorithm + SUBSP + Subspace algorithm - UNSYM - Unsymmetric matrix + UNSYM + Unsymmetric matrix - DAMP - Damped system + DAMP + Damped system - QRDAMP - Damped system using QR algorithm + QRDAMP + Damped system using QR algorithm - VT - Variational Technology + VT + Variational Technology nmode The number of modes to extract. The value can depend on the value @@ -837,36 +887,43 @@ def modopt( Complex eigenmode key. (Valid only when Method = QRDAMP or Method = UNSYM). - AUTO - Determine automatically if the eigensolutions are real or complex and output - them accordingly. This is the default for Method = UNSYM. - Not supported for Method = QRDAMP. + AUTO + Determine automatically if the eigensolutions are real or complex and output + them accordingly. This is the default for Method = UNSYM. + Not supported for Method = QRDAMP. - ON or CPLX - Calculate and output complex eigenmode shapes. + ON or CPLX + Calculate and output complex eigenmode shapes. - OFF or REAL - Do not calculate complex eigenmode shapes. This is required if a mode- - superposition analysis is intended after the modal - analysis for Method = QRDAMP. This is the default for - this method. + OFF or REAL + Do not calculate complex eigenmode shapes. This is required if a mode- + superposition analysis is intended after the modal + analysis for Method = QRDAMP. This is the default for + this method. nrmkey Mode shape normalization key: - OFF - Normalize the mode shapes to the mass matrix (default). + OFF + Normalize the mode shapes to the mass matrix (default). - ON - Normalize the mode shapes to unity instead of to the mass matrix. If a - subsequent spectrum or mode-superposition analysis is planned, - the mode shapes should be normalized to the mass matrix - (Nrmkey = OFF). + ON + Normalize the mode shapes to unity instead of to the mass matrix. If a + subsequent spectrum or mode-superposition analysis is planned, + the mode shapes should be normalized to the mass matrix + (Nrmkey = OFF). modtype Type of modes calculated by the eigensolver. Only applicable to the unsymmetric eigensolver. - Blank - Right eigenmodes. This value is the default. + Blank + Right eigenmodes. This value is the default. - BOTH - Right and left eigenmodes. The left eigenmodes are written to Jobname.LMODE. - This option must be activated if a mode-superposition - analysis is intended. + BOTH + Right and left eigenmodes. The left eigenmodes are written to Jobname.LMODE. + This option must be activated if a mode-superposition + analysis is intended. blocksize The block vector size to be used with the Block Lanczos or @@ -976,10 +1033,12 @@ def mxpand( elcalc Element calculation key: - NO - Do not calculate element results, reaction forces, and energies (default). + NO + Do not calculate element results, reaction forces, and energies (default). - YES - Calculate element results, reaction forces, energies, and the nodal degree of - freedom solution. + YES + Calculate element results, reaction forces, energies, and the nodal degree of + freedom solution. signif Expand only those modes whose significance level exceeds the SIGNIF @@ -988,27 +1047,33 @@ def mxpand( msupkey Element result superposition key: - NO - Do not write element results to the mode file Jobname.MODE. + NO + Do not write element results to the mode file Jobname.MODE. - YES - Write element result to the mode file for use in the expansion pass of a - subsequent mode-superposition PSD, transient, or harmonic - analysis (default if Elcalc = YES and the mode shapes are - normalized to the mass matrix). + YES + Write element result to the mode file for use in the expansion pass of a + subsequent mode-superposition PSD, transient, or harmonic + analysis (default if Elcalc = YES and the mode shapes are + normalized to the mass matrix). modeselmethod Methods for mode selection (not supported for complex eigensolvers): - blank - No mode selection is performed (default). + blank + No mode selection is performed (default). - MODM - The mode selection is based on the modal effective masses. + MODM + The mode selection is based on the modal effective masses. - MODC - The mode selection is based on the mode coefficients. + MODC + The mode selection is based on the mode coefficients. - DDAM - The mode selection is based on DDAM procedure (see Mode Selection Based on DDAM - Procedure in the Mechanical APDL Structural Analysis Guide - for more information). This option is applicable only to - DDAM spectrum analysis. + DDAM + The mode selection is based on DDAM procedure (see Mode Selection Based on DDAM + Procedure in the Mechanical APDL Structural Analysis Guide + for more information). This option is applicable only to + DDAM spectrum analysis. Notes ----- @@ -1071,20 +1136,24 @@ def qrdopt(self, reusekey="", symmeth="", cmccoutkey="", **kwargs): reusekey Reuse key for method=QRDAMP specified in MODOPT command. - ON - Reuse the symmetric eigensolution from the previous - load steps or from the previous solution. + ON + Reuse the symmetric eigensolution from the previous + load steps or from the previous solution. - OFF - Do not reuse (calculates symmetric eigensolution at - current load step). This is the default. + OFF + Do not reuse (calculates symmetric eigensolution at + current load step). This is the default. symmeth Mode-extraction method to be used for the symmetric eigenvalue problem. - LANB - Block Lanczos (default for shared-memory parallel processing). + LANB + Block Lanczos (default for shared-memory parallel processing). - SUBSP - Subspace algorithm (default for distributed-memory - parallel processing). + SUBSP + Subspace algorithm (default for distributed-memory + parallel processing). cmccoutkey Complex Modal Contribution Coefficients (CMCC) output @@ -1092,9 +1161,11 @@ def qrdopt(self, reusekey="", symmeth="", cmccoutkey="", **kwargs): Coefficients (CMCC) in the Structural Analysis Guide for details and usage. - ON - Output the CMCC to the text file Jobname.CMCC. + ON + Output the CMCC to the text file Jobname.CMCC. - OFF - Do not output the CMCC. This is the default. + OFF + Do not output the CMCC. This is the default. Notes ----- @@ -1162,26 +1233,42 @@ def subopt(self, option="", value1="", **kwargs): option One of the following options: - STRMCK - Controls whether a Sturm sequence check is performed. + STRMCK + Controls whether a Sturm sequence check is performed. + Valid input for Value1 when Option = STRMCK: + + OFF + Do not perform Sturm sequence check (default). + + ON + Perform Sturm sequence check. - Value1: - OFF + MEMORY + Controls the memory allocation strategy for the Subspace eigensolver. + Valid input for Value1 when Option = MEMORY: - Do not perform Sturm sequence check (default). - ON + AUTO + Use the default memory allocation strategy (``default``). - Perform Sturm sequence check. - MEMORY + INCORE + Force the Subspace eigensolver to allocate in-core memory. - Controls the memory allocation strategy for the Subspace eigensolver. - Value1: + MIX1 + First level of mixed in-core / out-of-core configuration. - AUTO - Use the default memory allocation strategy (default). + MIX2 + Second level of mixed in-core / out-of-core configuration. - INCORE - Force the Subspace eigensolver to allocate in-core memory. + OUTOFCORE + Force the Subspace eigensolver to use scratch files. - OUTOFCORE - Force the Subspace eigensolver to use scratch files. + Value1 + Assigned value for the specified Option (as described above). Notes ----- - SUBOPT specifies options to be used with the Subspace eigensolver - (MODOPT,SUBSP) during a modal analysis. + ``SUBOPT`` specifies options to be used with the Subspace eigensolver + (``MODOPT,SUBSP``) during a modal analysis. """ command = f"SUBOPT,{option},{value1}" return self.run(command, **kwargs) @@ -1196,26 +1283,35 @@ def timint(self, key="", lab="", **kwargs): key Transient effects key: - OFF - No transient effects (static or steady-state). + OFF + No transient effects (static or steady-state). - ON - Include transient (mass or inertia) effects. + ON + Include transient (mass or inertia) effects. lab Degree of freedom label: - ALL - Apply this key to all appropriate labels (default). + ALL + Apply this key to all appropriate labels (default). - STRUC - Apply this key to structural DOFs. + STRUC + Apply this key to structural DOFs. - THERM - Apply this key to thermal DOFs. + THERM + Apply this key to thermal DOFs. - ELECT - Apply this key to electric DOFs. + ELECT + Apply this key to electric DOFs. - MAG - Apply this key to magnetic DOFs. + MAG + Apply this key to magnetic DOFs. - FLUID - Apply this key to fluid DOFs. + FLUID + Apply this key to fluid DOFs. - DIFFU - Apply this key to concentration of DOFs. + DIFFU + Apply this key to concentration of DOFs. Notes ----- @@ -1282,10 +1378,12 @@ def tintp( avsmooth Smoothing flag option: - 0 - Include smoothing of the velocity (1st order system) + 0 + Include smoothing of the velocity (1st order system) or the acceleration (2nd order system) (default). - 1 - Do not include smoothing. + 1 + Do not include smoothing. alphaf Interpolation factor in HHT algorithm for force and damping terms @@ -1329,6 +1427,7 @@ def trnopt( self, method="", maxmode="", + initialacc="", minmode="", mcfwrite="", tintopt="", @@ -1347,17 +1446,30 @@ def trnopt( method Solution method for the transient analysis: - FULL - Full method (default). + FULL + Full method (default). - MSUP - Mode-superposition method. + MSUP + Mode-superposition method. - VT - Variational Technology method. (Removed by V18.2) + VT + Variational Technology method. (Removed by V18.2) maxmode Largest mode number to be used to calculate the response (for Method = MSUP). Defaults to the highest mode calculated in the preceding modal analysis. + initialacc + Key to activate calculation of initial acceleration: + + (blank) + Initial accelerations are not calculated (default). + + INIL + Calculate initial acceleration for a full transient analysis + using the lumped mass matrix. + minmode Smallest mode number to be used (for Method = MSUP). Defaults to 1. @@ -1366,25 +1478,31 @@ def trnopt( Modal coordinates output key to the .mcf file (valid only for the mode-superposition method): - NO - No output of modal coordinates (default). + NO + No output of modal coordinates (default). - YES - Output modal coordinates to the text file Jobname.MCF. + YES + Output modal coordinates to the text file Jobname.MCF. tintopt Time integration method for the transient analysis: - NMK or 0 - Newmark algorithm (default). + NMK or 0 + Newmark algorithm (default). - HHT or 1 - HHT algorithm (valid only for the full transient method). + HHT or 1 + HHT algorithm (valid only for the full transient method). vaout Velocities and accelerations output key (valid only for mode- superposition transient analysis): - NO - No output of velocities and accelerations (default). + NO + No output of velocities and accelerations (default). - YES - Write velocities and accelerations on the reduced displacement file - Jobname.RDSP. + YES + Write velocities and accelerations on the reduced displacement + file Jobname.RDSP. dmpsfreq Average excitation frequency (Hz) for the calculation of @@ -1399,22 +1517,26 @@ def trnopt( engcalc Additional element energies calculation key: - NO - Do not calculate additional element energies - (default). + NO + Do not calculate additional element energies + (default). - YES - Calculate damping energy and work done by external - loads. + YES + Calculate damping energy and work done by external + loads. mckey Modal coordinates output key to the .rdsp file (valid only for the mode-superposition method): - AUTO - Writing depends on the modal analysis settings of - the MXPAND command (default). + AUTO + Writing depends on the modal analysis settings of + the MXPAND command (default). - YES - Always write the modal coordinates to the file - Jobname.rdsp. A subsequent expansion pass (EXPASS) is not - supported. + YES + Always write the modal coordinates to the file + Jobname.rdsp. A subsequent expansion pass (EXPASS) is not + supported. Notes ----- @@ -1446,5 +1568,6 @@ def trnopt( This command is also valid in PREP7. """ - command = f"TRNOPT,{method},{maxmode},,{minmode},{mcfwrite},{tintopt},{vaout},{dmpsfreq},{engcalc},{mckey}" + command = f"TRNOPT,{method},{maxmode},{initialacc},{minmode},{mcfwrite},{tintopt},{vaout},{dmpsfreq},{engcalc},{mckey}" return self.run(command, **kwargs) + # TRNOPT,Method,MAXMODE,InitialAcc,MINMODE,MCFwrite,TINTOPT,VAout, DMPSFreq, EngCalc, MCkey diff --git a/src/ansys/mapdl/core/_commands/solution/fe_body_loads.py b/src/ansys/mapdl/core/_commands/solution/fe_body_loads.py index 2eb21cb396..832c097cd5 100644 --- a/src/ansys/mapdl/core/_commands/solution/fe_body_loads.py +++ b/src/ansys/mapdl/core/_commands/solution/fe_body_loads.py @@ -708,7 +708,7 @@ def rimport( DYNA - Get initial stresses from an earlier explicit (ANSYS LS-DYNA) run (default). - type\_ + type\\_ Type of data imported. Note that this is an ANSYS-defined field; the only valid value is STRESS. diff --git a/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py b/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py index 194e0e5d48..6d45cce41b 100644 --- a/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py +++ b/src/ansys/mapdl/core/_commands/solution/miscellaneous_loads.py @@ -1139,7 +1139,7 @@ def rescontrol( maxfiles Maximum number of ``.Xnnn`` files to save for Ldstep. - \-1 + \\-1 Overwrite existing ``.Xnnn`` files (default). The total maximum number of ``.Xnnn`` files for one run is 999. If this number is reached before the analysis is complete, the program will reset the ``.Xnnn`` file numbering back to 1 and continue to write diff --git a/src/ansys/mapdl/core/_commands/solution/multi_field_solver_load_transfer.py b/src/ansys/mapdl/core/_commands/solution/multi_field_solver_load_transfer.py index 5e1df79e6b..4b1861bf25 100644 --- a/src/ansys/mapdl/core/_commands/solution/multi_field_solver_load_transfer.py +++ b/src/ansys/mapdl/core/_commands/solution/multi_field_solver_load_transfer.py @@ -40,7 +40,7 @@ def mflcomm( Parameters ---------- - type\_ + type\\_ Set to SURF for a surface load transfer. Only surface load transfers are available for MFX. diff --git a/src/ansys/mapdl/core/_commands/solution/radiosity.py b/src/ansys/mapdl/core/_commands/solution/radiosity.py index 373bedc495..ff2e1d852d 100644 --- a/src/ansys/mapdl/core/_commands/solution/radiosity.py +++ b/src/ansys/mapdl/core/_commands/solution/radiosity.py @@ -87,7 +87,7 @@ def rsopt(self, opt="", filename="", ext="", dir_="", **kwargs): Filename extension for radiosity mapping data file (default = .rsm). - dir\_ + dir\\_ Directory path for radiosity mapping data file. If you do not specify a directory path, it will default to your working directory. diff --git a/src/ansys/mapdl/core/_commands/solution/spectrum_options.py b/src/ansys/mapdl/core/_commands/solution/spectrum_options.py index 19a8252d41..bd61e0b5fa 100644 --- a/src/ansys/mapdl/core/_commands/solution/spectrum_options.py +++ b/src/ansys/mapdl/core/_commands/solution/spectrum_options.py @@ -824,7 +824,7 @@ def psdunit(self, tblno="", type_="", gvalue="", **kwargs): tblno Input table number. - type\_ + type\\_ Label identifying the type of spectrum: DISP - Displacement spectrum (in terms of displacement2/Hz ). @@ -1340,7 +1340,7 @@ def spunit(self, tblno="", type_="", gvalue="", keyinterp="", **kwargs): tblno Input table number. - type\_ + type\\_ Label identifying the type of spectrum: DISP - Displacement spectrum (SPVAL values interpreted as displacements with units of diff --git a/src/ansys/mapdl/core/_version.py b/src/ansys/mapdl/core/_version.py index 43f141899d..2b73beb61c 100644 --- a/src/ansys/mapdl/core/_version.py +++ b/src/ansys/mapdl/core/_version.py @@ -41,6 +41,7 @@ # In descending order SUPPORTED_ANSYS_VERSIONS = { + 242: "2024R2", 241: "2024R1", 232: "2023R2", 231: "2023R1", diff --git a/src/ansys/mapdl/core/cli.py b/src/ansys/mapdl/core/cli.py index c0400e645a..208df4033f 100644 --- a/src/ansys/mapdl/core/cli.py +++ b/src/ansys/mapdl/core/cli.py @@ -470,6 +470,10 @@ def start( + " The following argument is not allowed in CLI: 'license_server_check'.\nIgnoring argument." ) + # Ignoring env var if using CLI + if "PYMAPDL_START_INSTANCE" in os.environ: + os.environ.pop("PYMAPDL_START_INSTANCE") + out = launch_mapdl( exec_file=exec_file, just_launch=True, diff --git a/src/ansys/mapdl/core/commands.py b/src/ansys/mapdl/core/commands.py index 22ba55e48e..ab317d2172 100644 --- a/src/ansys/mapdl/core/commands.py +++ b/src/ansys/mapdl/core/commands.py @@ -204,7 +204,7 @@ def get_section_indentation(section_name, docstring): def inject_before(section, indentation, indented_doc_inject, docstring): return re.sub( section + r"\n\s*-*", - f"{indented_doc_inject.strip()}\n\n{indentation}\g<0>", + f"{indented_doc_inject.strip()}\n\n{indentation}" + r"\g<0>", docstring, flags=re.IGNORECASE, ) @@ -278,7 +278,7 @@ def func_wrapper(self, *args, **kwargs): if ( "*** WARNING ***" in output or "*** ERROR ***" in output ): # Error should be caught in mapdl.run. - err_type = re.findall("\*\*\* (.*) \*\*\*", output)[0] + err_type = re.findall(r"*** (.*) ***", output)[0] msg = f"Unable to parse because of next {err_type.title()}" + "\n".join( output.splitlines()[-2:] ) diff --git a/src/ansys/mapdl/core/database/database.py b/src/ansys/mapdl/core/database/database.py index 3323a664d1..5877af5f6e 100644 --- a/src/ansys/mapdl/core/database/database.py +++ b/src/ansys/mapdl/core/database/database.py @@ -37,6 +37,7 @@ from ..mapdl_grpc import MapdlGrpc MINIMUM_MAPDL_VERSION = "21.1" +FAILING_DATABASE_MAPDL = ["24.1", "24.2"] class WithinBeginLevel: @@ -236,9 +237,10 @@ def start(self, timeout=10): ) ## Checking MAPDL versions - mapdl_version = self._mapdl.version - if not server_meets_version( - str(mapdl_version), MINIMUM_MAPDL_VERSION + mapdl_version = str(self._mapdl.version) + if ( + not server_meets_version(mapdl_version, MINIMUM_MAPDL_VERSION) + or mapdl_version in FAILING_DATABASE_MAPDL ): # pragma: no cover from ansys.mapdl.core.errors import MapdlVersionError diff --git a/src/ansys/mapdl/core/errors.py b/src/ansys/mapdl/core/errors.py index a2c660879e..79aaa60deb 100644 --- a/src/ansys/mapdl/core/errors.py +++ b/src/ansys/mapdl/core/errors.py @@ -316,7 +316,9 @@ def wrapper(*args, **kwargs): # Must close unfinished processes mapdl._close_process() - raise MapdlExitedError("MAPDL server connection terminated") from None + raise MapdlExitedError( + f"MAPDL server connection terminated with the following error\n{error}" + ) from None if threading.current_thread().__class__.__name__ == "_MainThread": received_interrupt = bool(SIGINT_TRACKER) diff --git a/src/ansys/mapdl/core/launcher.py b/src/ansys/mapdl/core/launcher.py index 4b55ed5b05..d5761ecf02 100644 --- a/src/ansys/mapdl/core/launcher.py +++ b/src/ansys/mapdl/core/launcher.py @@ -70,7 +70,6 @@ from ansys.mapdl.core.misc import ( check_valid_ip, check_valid_port, - check_valid_start_instance, create_temp_dir, random_string, threaded, @@ -222,7 +221,7 @@ def port_in_use(port: Union[int, str], host: str = LOCALHOST) -> bool: def port_in_use_using_socket(port: Union[int, str], host: str) -> bool: - """Returns True when a port is in use at the given host using socket librry. + """Returns True when a port is in use at the given host using socket library. Must actually "bind" the address. Just checking if we can create a socket is insufficient as it's possible to run into permission @@ -284,7 +283,6 @@ def launch_grpc( ram: Optional[int] = None, run_location: str = None, port: int = MAPDL_DEFAULT_PORT, - ip: str = LOCALHOST, additional_switches: str = "", override: bool = True, timeout: int = 20, @@ -596,7 +594,9 @@ def launch_grpc( env_vars = update_env_vars(add_env_vars, replace_env_vars) - LOG.info(f"Running in {ip}:{port} the following command: '{command}'") + LOG.info( + f"Running a local instance at port {port} the following command: '{command}'" + ) LOG.debug("MAPDL starting in background.") process = subprocess.Popen( @@ -778,12 +778,12 @@ def launch_remote_mapdl( ) -def get_start_instance(start_instance_default=True): +def get_start_instance(start_instance: bool = True): """Check if the environment variable ``PYMAPDL_START_INSTANCE`` exists and is valid. Parameters ---------- - start_instance_default : bool + start_instance : bool Value to return when ``PYMAPDL_START_INSTANCE`` is unset. Returns @@ -791,7 +791,7 @@ def get_start_instance(start_instance_default=True): bool ``True`` when the ``PYMAPDL_START_INSTANCE`` environment variable is true, ``False`` when PYMAPDL_START_INSTANCE is false. If unset, - returns ``start_instance_default``. + returns ``start_instance``. Raises ------ @@ -799,26 +799,46 @@ def get_start_instance(start_instance_default=True): Raised when ``PYMAPDL_START_INSTANCE`` is not either true or false (case independent). + Notes + ----- + If the environment variable ``PYMAPDL_START_INSTANCE`` is set, + hence the argument ``start_instance`` is overwritten. + """ - if "PYMAPDL_START_INSTANCE" in os.environ: - if os.environ["PYMAPDL_START_INSTANCE"].lower() not in [ - "true", - "false", - ]: - val = os.environ["PYMAPDL_START_INSTANCE"] - raise OSError( - f'Invalid value "{val}" for PYMAPDL_START_INSTANCE\n' - 'PYMAPDL_START_INSTANCE should be either "TRUE" or "FALSE"' + if "PYMAPDL_START_INSTANCE" in os.environ and os.environ["PYMAPDL_START_INSTANCE"]: + # It should not be empty + if isinstance(start_instance, bool): + warnings.warn( + "The environment variable 'PYMAPDL_START_INSTANCE' is set, " + "hence the argument 'start_instance' is overwritten." ) + start_instance = os.environ["PYMAPDL_START_INSTANCE"] + else: LOG.debug( - f"PYMAPDL_START_INSTANCE is set to {os.environ['PYMAPDL_START_INSTANCE']}" + f"PYMAPDL_START_INSTANCE is unset. Using default value {start_instance}." ) - return os.environ["PYMAPDL_START_INSTANCE"].lower() == "true" - LOG.debug( - f"PYMAPDL_START_INSTANCE is unset, using default value {start_instance_default}" - ) - return start_instance_default + if isinstance(start_instance, str): + start_instance = start_instance.lower().strip() + if start_instance not in ["true", "false"]: + raise OSError( + f'Invalid value "{start_instance}" for "start_instance" (or "PYMAPDL_START_INSTANCE"\n' + '"start_instance" should be either "TRUE" or "FALSE"' + ) + + LOG.debug(f"PYMAPDL_START_INSTANCE is set to {start_instance}") + return start_instance == "true" + + elif isinstance(start_instance, bool): + return start_instance + + elif start_instance is None: + LOG.debug( + "'PYMAPDL_START_INSTANCE' is unset, and there is no supplied value. Using default, which is 'True'." + ) + return True # Default is true + else: + raise ValueError("Only booleans are allowed as arguments.") def get_default_ansys(): @@ -1152,13 +1172,14 @@ def launch_mapdl( ip : bool, optional Used only when ``start_instance`` is ``False``. If provided, - it will force ``start_instance`` to be ``False``. + and ``start_instance`` (or its correspondent environment variable + ``PYMAPDL_START_INSTANCE``) is ``True`` then, an exception is raised. Specify the IP address of the MAPDL instance to connect to. You can also provide a hostname as an alternative to an IP address. Defaults to ``'127.0.0.1'``. You can also override the default behavior of this keyword argument with the - environment variable ``PYMAPDL_IP=``. - This argument has priority over the environment variable. + environment variable ``PYMAPDL_IP=``. If this environment variable + is empty, it is as it is not set. clear_on_connect : bool, optional Defaults to ``True``, giving you a fresh environment when @@ -1281,96 +1302,96 @@ def launch_mapdl( running MAPDL as a service via gRPC. Excluded switches such as ``"-j"`` either not applicable or are set via keyword arguments. - \-acc + \\-acc Enables the use of GPU hardware. See GPU Accelerator Capability in the Parallel Processing Guide for more information. - \-amfg + \\-amfg Enables the additive manufacturing capability. Requires an additive manufacturing license. For general information about this feature, see AM Process Simulation in ANSYS Workbench. - \-ansexe + \\-ansexe Activates a custom mechanical APDL executable. In the ANSYS Workbench environment, activates a custom Mechanical APDL executable. - \-custom + \\-custom Calls a custom Mechanical APDL executable See Running Your Custom Executable in the Programmer's Reference for more information. - \-db value + \\-db value Initial memory allocation Defines the portion of workspace (memory) to be used as the initial allocation for the database. The default is 1024 MB. Specify a negative number to force a fixed size throughout the run; useful on small memory systems. - \-dis + \\-dis Enables Distributed ANSYS See the Parallel Processing Guide for more information. - \-dvt + \\-dvt Enables ANSYS DesignXplorer advanced task (add-on). Requires DesignXplorer. - \-l + \\-l Specifies a language file to use other than English This option is valid only if you have a translated message file in an appropriately named subdirectory in ``/ansys_inc/v201/ansys/docu`` or ``Program Files\\ANSYS\\Inc\\V201\\ANSYS\\docu`` - \-m + \\-m Specifies the total size of the workspace Workspace (memory) in megabytes used for the initial allocation. If you omit the ``-m`` option, the default is 2 GB (2048 MB). Specify a negative number to force a fixed size throughout the run. - \-machines + \\-machines Specifies the distributed machines Machines on which to run a Distributed ANSYS analysis. See Starting Distributed ANSYS in the Parallel Processing Guide for more information. - \-mpi + \\-mpi Specifies the type of MPI to use. See the Parallel Processing Guide for more information. - \-mpifile + \\-mpifile Specifies an existing MPI file Specifies an existing MPI file (appfile) to be used in a Distributed ANSYS run. See Using MPI Files in the Parallel Processing Guide for more information. - \-na + \\-na Specifies the number of GPU accelerator devices Number of GPU devices per machine or compute node when running with the GPU accelerator feature. See GPU Accelerator Capability in the Parallel Processing Guide for more information. - \-name + \\-name Defines Mechanical APDL parameters Set mechanical APDL parameters at program start-up. The parameter name must be at least two characters long. For details about parameters, see the ANSYS Parametric Design Language Guide. - \-p + \\-p ANSYS session product Defines the ANSYS session product that will run during the session. For more detailed information about the ``-p`` option, see Selecting an ANSYS Product via the Command Line. - \-ppf + \\-ppf HPC license Specifies which HPC license to use during a parallel processing run. See HPC Licensing in the Parallel Processing Guide for more information. - \-smp + \\-smp Enables shared-memory parallelism. See the Parallel Processing Guide for more information. @@ -1461,8 +1482,28 @@ def launch_mapdl( ms_ = ", ".join([f"'{each}'" for each in kwargs.keys()]) raise ValueError(f"The following arguments are not recognized: {ms_}") - if ip is None: - ip = os.environ.get("PYMAPDL_IP", None) + # Getting IP from env var + ip_env_var = os.environ.get("PYMAPDL_IP", "") + if ip_env_var != "": + if ip: + warnings.warn( + "The env var 'PYMAPDL_IP' is set, hence the 'ip' argument is overwritten." + ) + + ip = ip_env_var + LOG.debug(f"An IP ({ip}) has been set using 'PYMAPDL_IP' env var.") + + ip = None if ip == "" else ip # Making sure the variable is not empty + + # Getting "start_instance" using "True" as default. + if (ip is not None) and (start_instance is None): + # An IP has been supplied. By default, 'start_instance' is equal + # false, unless it is set through the env vars. + start_instance = get_start_instance(start_instance=False) + else: + start_instance = get_start_instance(start_instance=start_instance) + + LOG.debug("Using 'start_instance' equal to %s.", start_instance) if ip is None: if ON_WSL: @@ -1472,8 +1513,9 @@ def launch_mapdl( f"On WSL: Using the following IP address for the Windows OS host: {ip}" ) else: - LOG.debug( - "PyMAPDL could not find the IP address of the Windows host machine." + raise MapdlDidNotStart( + "You seems to be working from WSL.\n" + "Unfortunately, PyMAPDL could not find the IP address of the Windows host machine." ) if not ip: @@ -1487,10 +1529,17 @@ def launch_mapdl( "Because 'PYMAPDL_IP' is not None, an attempt is made to connect to" " a remote session ('START_INSTANCE' is set to 'False')." ) - if not ON_WSL: - start_instance = False - else: + if ON_WSL: LOG.debug("On WSL: Allowing 'start_instance' and 'ip' arguments together.") + else: + if start_instance is True: + raise ValueError( + "When providing a value for the argument 'ip', the argument " + "'start_instance' cannot be 'True'.\n" + "Make sure the corresponding environment variables are not setting " + "those argument values.\n" + "For more information visit https://github.com/ansys/pymapdl/issues/2910" + ) ip = socket.gethostbyname(ip) # Converting ip or hostname to ip @@ -1521,30 +1570,16 @@ def launch_mapdl( version = _verify_version(version) # return a int version or none - # connect to an existing instance if enabled - if start_instance is None: - if "PYMAPDL_START_INSTANCE" in os.environ: - LOG.debug("Using PYMAPDL_START_INSTANCE environment variable.") - - if os.environ.get("PYMAPDL_START_INSTANCE") and os.environ.get( - "PYMAPDL_START_INSTANCE" - ).lower() not in ["true", "false"]: - raise ValueError("PYMAPDL_START_INSTANCE must be either True or False.") - - start_instance = check_valid_start_instance( - os.environ.get("PYMAPDL_START_INSTANCE", True) - ) - - LOG.debug("Using 'start_instance' equal to %s", start_instance) - + if start_instance: # special handling when building the gallery outside of CI. This - # creates an instance of mapdl the first time if PYMAPDL start instance - # is False. + # creates an instance of mapdl the first time. if pymapdl.BUILDING_GALLERY: # pragma: no cover LOG.debug("Building gallery.") # launch an instance of pymapdl if it does not already exist and # we're allowed to start instances - if start_instance and GALLERY_INSTANCE[0] is None: + if GALLERY_INSTANCE[0] is None: + LOG.debug("Loading first MAPDL instance for gallery building.") + GALLERY_INSTANCE[0] = "Loading..." mapdl = launch_mapdl( start_instance=True, cleanup_on_exit=False, @@ -1555,8 +1590,11 @@ def launch_mapdl( GALLERY_INSTANCE[0] = {"ip": mapdl._ip, "port": mapdl._port} return mapdl - # otherwise, connect to the existing gallery instance if available - elif GALLERY_INSTANCE[0] is not None: + # otherwise, connect to the existing gallery instance if available, but it needs to be fully loaded. + elif GALLERY_INSTANCE[0] != "Loading...": + LOG.debug( + "Connecting to an existing MAPDL instance for gallery building." + ) mapdl = MapdlGrpc( ip=GALLERY_INSTANCE[0]["ip"], port=GALLERY_INSTANCE[0]["port"], @@ -1570,35 +1608,39 @@ def launch_mapdl( mapdl.clear() return mapdl - # finally, if running on CI/CD, connect to the default instance else: - mapdl = MapdlGrpc( - ip=ip, - port=port, - cleanup_on_exit=False, - loglevel=loglevel, - set_no_abort=set_no_abort, - use_vtk=use_vtk, - **start_parm, - ) - if clear_on_connect: - mapdl.clear() - return mapdl + LOG.debug("Bypassing Gallery building flag for the first time.") - if not start_instance: + else: LOG.debug("Connecting to an existing instance of MAPDL at %s:%s", ip, port) if just_launch: print(f"There is an existing MAPDL instance at: {ip}:{port}") return + if _debug_no_launch: + return pack_parameters( + port, + ip, + add_env_vars, + replace_env_vars, + cleanup_on_exit, + loglevel, + set_no_abort, + remove_temp_dir_on_exit, + log_apdl, + use_vtk, + start_parm, + start_instance, + version, + ) + mapdl = MapdlGrpc( ip=ip, port=port, cleanup_on_exit=False, loglevel=loglevel, set_no_abort=set_no_abort, - log_apdl=log_apdl, use_vtk=use_vtk, **start_parm, ) @@ -1618,7 +1660,11 @@ def launch_mapdl( LOG.debug("Using default executable.") # Load cached path - exec_file = get_ansys_path(version=version) + if _debug_no_launch: + exec_file = "" + else: + exec_file = get_ansys_path(version=version) + if exec_file is None: raise FileNotFoundError( "Invalid exec_file path or cannot load cached " @@ -1659,7 +1705,7 @@ def launch_mapdl( # verify no lock file and the mode is valid check_lock_file(run_location, jobname, override) - if _HAS_ATP: + if _HAS_ATP and not _debug_no_launch: mode = check_mode(mode, version_from_path("mapdl", exec_file)) LOG.debug("Using mode %s", mode) else: @@ -1738,11 +1784,12 @@ def launch_mapdl( log_apdl, use_vtk, start_parm, + start_instance, + version, ) port, actual_run_location, process = launch_grpc( port=port, - ip=ip, add_env_vars=add_env_vars, replace_env_vars=replace_env_vars, **start_parm, @@ -2035,6 +2082,8 @@ def pack_parameters( log_apdl, use_vtk, start_parm, + start_instance, + version, ): # pack all the arguments in a dict for debugging purposes dict_ = {} @@ -2049,5 +2098,6 @@ def pack_parameters( dict_["log_apdl"] = log_apdl dict_["use_vtk"] = use_vtk dict_["start_parm"] = start_parm - + dict_["start_instance"] = start_instance + dict_["version"] = version return dict_ diff --git a/src/ansys/mapdl/core/mapdl_core.py b/src/ansys/mapdl/core/mapdl_core.py index 6b5773d609..14ca91aaff 100644 --- a/src/ansys/mapdl/core/mapdl_core.py +++ b/src/ansys/mapdl/core/mapdl_core.py @@ -34,7 +34,6 @@ import tempfile import time from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple, Union -import warnings from warnings import warn import weakref @@ -57,6 +56,7 @@ from ansys.mapdl.core.errors import ( ComponentNoData, MapdlCommandIgnoredError, + MapdlFileNotFoundError, MapdlInvalidRoutineError, MapdlRuntimeError, ) @@ -1977,7 +1977,7 @@ def run_multiline(self, commands) -> str: """ - warnings.warn( + warn( "'run_multiline()' is being deprecated in future versions.\n Please use 'input_strings'.", DeprecationWarning, ) @@ -2273,16 +2273,18 @@ def __del__(self): pass def _get_plot_name(self, text: str) -> str: - """ "Obtain the plot filename. It also downloads it if in remote session.""" + """Obtain the plot filename.""" self._log.debug(text) png_found = PNG_IS_WRITTEN_TO_FILE.findall(text) if png_found: # flush graphics writer + previous_device = self.file_type_for_plots self.show("CLOSE", mute=True) # self.show("PNG", mute=True) filename = self._screenshot_path() + self.show(previous_device) self._log.debug(f"Screenshot at: {filename}") if os.path.isfile(filename): @@ -2676,7 +2678,13 @@ def _perform_entity_list_selection( def _raise_errors(self, text): # to make sure the following error messages are caught even if a breakline is in between. flat_text = " ".join([each.strip() for each in text.splitlines()]) - base_error_msg = "\n\nIgnore these messages by setting 'ignore_errors'=True" + base_error_msg = "\n\nIgnore these messages by setting 'ignore_errors'=True.\n" + + if "unable to open file" in flat_text or ( + "unable to open" in flat_text and "file" in flat_text + ): + text += base_error_msg + raise MapdlFileNotFoundError(text) if "is not a recognized" in flat_text: text = text.replace("This command will be ignored.", "") @@ -2694,6 +2702,25 @@ def _raise_errors(self, text): text += base_error_msg raise ComponentNoData(text) + if "is not part of the currently active set." in flat_text: + text += base_error_msg + raise MapdlCommandIgnoredError(text) + + if "No nodes defined." in flat_text: + text += base_error_msg + raise MapdlCommandIgnoredError(text) + + if "For element type = " in flat_text and "is invalid." in flat_text: + if "is normal behavior when a CDB file is used." in flat_text: + warn(text, UserWarning) + else: + text += base_error_msg + raise MapdlCommandIgnoredError(text) + + if "Cannot create another with the same name" in flat_text: + # When overriding constitutive models. See 'test_tbft' + warn(text, UserWarning) + # flag errors if "*** ERROR ***" in flat_text: self._raise_output_errors(text) @@ -2794,7 +2821,7 @@ def _check_on_docker(self): if self.platform == "linux": self.sys( - "if grep -sq 'docker\|lxc' /proc/1/cgroup; then echo 'true' > __outputcmd__.txt; else echo 'false' > __outputcmd__.txt;fi;" + r"if grep -sq 'docker\|lxc' /proc/1/cgroup; then echo 'true' > __outputcmd__.txt; else echo 'false' > __outputcmd__.txt;fi;" ) elif self.platform == "windows": # pragma: no cover return False # TODO: check if it is running a windows docker container. So far it is not supported. diff --git a/src/ansys/mapdl/core/mapdl_extended.py b/src/ansys/mapdl/core/mapdl_extended.py index 9a27e6a8cf..fe18ae9adf 100644 --- a/src/ansys/mapdl/core/mapdl_extended.py +++ b/src/ansys/mapdl/core/mapdl_extended.py @@ -1352,7 +1352,7 @@ def inquire(self, strarray="", func="", arg1="", arg2=""): "RSTFILE", "RSTEXT", "OUTPUT", - "ENVNAME", + "ENV", "TITLE", "EXIST", "DATE", diff --git a/src/ansys/mapdl/core/mapdl_grpc.py b/src/ansys/mapdl/core/mapdl_grpc.py index 222319f9c2..3a7e3bf0f6 100644 --- a/src/ansys/mapdl/core/mapdl_grpc.py +++ b/src/ansys/mapdl/core/mapdl_grpc.py @@ -880,7 +880,9 @@ def _run(self, cmd: str, verbose: bool = False, mute: Optional[bool] = None) -> mute = self._mute if self._exited: - raise MapdlExitedError + raise MapdlExitedError( + f"The MAPDL instance has been exited before running the command: {cmd}" + ) # don't allow empty commands if not cmd.strip(): @@ -1082,7 +1084,7 @@ def _kill_server(self): pass if ( - self._version >= 24.2 + self._version and self._version >= 24.2 ): # We can't use the non-cached version because of recursion error. # self.run("/EXIT,NOSAVE,,,,,SERVER") self._ctrl("EXIT") @@ -1141,6 +1143,7 @@ def _close_process(self, timeout=2): # pragma: no cover processes making this method ineffective for a local instance of MAPDL. """ + self._log.debug("Closing processes") if self._local: # killing server process self._kill_server() @@ -3477,3 +3480,72 @@ def parain( scale=scale, **kwargs, ) + + def screenshot(self, savefig: Optional[str] = None): + """Take an MAPDL screenshot and show it in a popup window. + + Parameters + ---------- + savefig : Optional[str], optional + Name of or path to the screenshot file. + The default is ``None``. + + Returns + ------- + str + File name. + + Raises + ------ + FileNotFoundError + If the path given in the ``savefig`` parameter is not found or is not consistent. + ValueError + If given a wrong type for the ``savefig`` parameter. + """ + previous_device = self.file_type_for_plots + self.show("PNG") + out_ = self.replot() + self.show(previous_device) # previous device + file_name = self._get_plot_name(out_) + + def get_file_name(path): + """Get a new filename so as not to overwrite an existing one.""" + target_dir = os.path.join(path, "mapdl_screenshot_0.png") + i = 0 + while os.path.exists(target_dir): + # Ensuring file is not overwritten. + i += 1 + target_dir = os.path.join(path, f"mapdl_screenshot_{i}.png") + return target_dir + + if savefig is None or savefig is False: + self._display_plot(file_name) + + else: + if savefig is True: + # Copying to working directory + target_dir = get_file_name(os.getcwd()) + + elif isinstance(savefig, str): + if not os.path.dirname(savefig): + # File name given only + target_dir = os.path.join(os.getcwd(), savefig) + + elif os.path.isdir(savefig): + # Given directory path only, but not file name. + target_dir = get_file_name(savefig) + + elif os.path.exists(os.path.dirname(savefig)): + # Only directory is given. Checking if directory exists. + target_dir = savefig + + else: + raise FileNotFoundError("The filename or path is not valid.") + + else: + raise ValueError( + "Only strings or Booleans are valid inputs for the 'savefig' parameter." + ) + + shutil.copy(file_name, target_dir) + return os.path.basename(target_dir) diff --git a/src/ansys/mapdl/core/misc.py b/src/ansys/mapdl/core/misc.py index d9ef258ecd..9eeec2a585 100644 --- a/src/ansys/mapdl/core/misc.py +++ b/src/ansys/mapdl/core/misc.py @@ -646,36 +646,6 @@ def check_valid_port(port, lower_bound=1000, high_bound=60000): ) -def check_valid_start_instance(start_instance): - """ - Checks if the value obtained from the environmental variable is valid. - - Parameters - ---------- - start_instance : str - Value obtained from the corresponding environment variable. - - Returns - ------- - bool - Returns ``True`` if ``start_instance`` is ``True`` or ``"True"``, - ``False`` if otherwise. - - """ - if not isinstance(start_instance, (str, bool)): - raise ValueError("The value 'start_instance' should be an string or a boolean.") - - if isinstance(start_instance, bool): - return start_instance - - if start_instance.lower() not in ["true", "false"]: - raise ValueError( - f"The value 'start_instance' should be equal to 'True' or 'False' (case insensitive)." - ) - - return start_instance.lower() == "true" - - def update_information_first(update=False): """ Decorator to wrap :class:`Information ` diff --git a/src/ansys/mapdl/core/parameters.py b/src/ansys/mapdl/core/parameters.py index 39e1c27d84..8796afa2d3 100644 --- a/src/ansys/mapdl/core/parameters.py +++ b/src/ansys/mapdl/core/parameters.py @@ -149,7 +149,7 @@ def numcpu(self) -> int: def routine(self) -> str: """Current routine string as a string. For example ``"/PREP7"`` - MAPDL Command: \*GET, ACTIVE, 0, ROUT + MAPDL Command: \\*GET, ACTIVE, 0, ROUT Returns ------- @@ -532,7 +532,7 @@ def _get_parameter_array(self, parm_name, shape): """ escaped = False for each_format_number in [20, 30, 40, 64, 100]: - format_str = f"(1F{each_format_number}.12)" + format_str = f"(1E{each_format_number}.12)" with self._mapdl.non_interactive: # use C ordering self._mapdl.mwrite(parm_name.upper(), label="kji") @@ -564,7 +564,7 @@ def _set_parameter_array(self, name, arr): """Load a numpy array or python list directly to MAPDL Writes the numpy array to disk and then reads it in within - MAPDL using \*VREAD. + MAPDL using \\*VREAD. Parameters ---------- @@ -751,12 +751,12 @@ def is_array_listing(status): def interp_star_status(status): - """Interprets \*STATUS command output from MAPDL + """Interprets \\*STATUS command output from MAPDL Parameters ---------- status : str - Output from MAPDL \*STATUS + Output from MAPDL \\*STATUS Returns ------- diff --git a/src/ansys/mapdl/core/plotting.py b/src/ansys/mapdl/core/plotting.py index 7db63a22d2..f55fc71817 100644 --- a/src/ansys/mapdl/core/plotting.py +++ b/src/ansys/mapdl/core/plotting.py @@ -21,6 +21,7 @@ # SOFTWARE. """Plotting helper for MAPDL using pyvista""" +from collections import OrderedDict from typing import Any, Optional from warnings import warn @@ -48,16 +49,20 @@ "FY", "FZ", "AMPS", - "CHRGS", + "CHRG", # "FLUX", "CSGZ", ] # TODO: Add moments MX, MY, MZ FIELDS = { "MECHANICAL": ["UX", "UY", "UZ", "FX", "FY", "FZ"], "THERMAL": ["TEMP", "HEAT"], - "ELECTRICAL": ["VOLT", "CHRGS", "AMPS"], + "ELECTRICAL": ["VOLT", "CHRG", "AMPS"], } +FIELDS_ORDERED_LABELS = FIELDS["MECHANICAL"].copy() +FIELDS_ORDERED_LABELS.extend(FIELDS["THERMAL"]) +FIELDS_ORDERED_LABELS.extend(FIELDS["ELECTRICAL"]) + # All boundary conditions: BCS = BC_D.copy() @@ -66,99 +71,12 @@ # Allowed entities to plot their boundary conditions ALLOWED_TARGETS = ["NODES"] - if _HAS_PYVISTA: import pyvista as pv - # Symbols for constrains - TEMP = pv.Sphere(center=(0, 0, 0), radius=0.5) - - UX = pv.Arrow( - start=(-1, 0, 0), - direction=(1, 0, 0), - tip_length=1, - tip_radius=0.5, - scale=1.0, - ) - UY = pv.Arrow( - start=(0, -1, 0), - direction=(0, 1, 0), - tip_length=1, - tip_radius=0.5, - scale=1.0, - ) - - UZ = pv.Arrow( - start=(0, 0, -1), - direction=(0, 0, 1), - tip_length=1, - tip_radius=0.5, - scale=1.0, - ) - - FX = pv.Arrow( - start=(-1, 0, 0), - direction=(1, 0, 0), - tip_length=0.5, - tip_radius=0.25, - scale=1.0, - ) - FY = pv.Arrow( - start=(0, -1, 0), - direction=(0, 1, 0), - tip_length=0.5, - tip_radius=0.25, - scale=1.0, - ) - - FZ = pv.Arrow( - start=(0, 0, -1), - direction=(0, 0, 1), - tip_length=0.5, - tip_radius=0.25, - scale=1.0, - ) - - def get_VOLT(): - model_a = pv.Cylinder( - center=(0, 0, 0), direction=(1, 0, 0), radius=0.2, height=2 - ).triangulate() - - model_b = pv.Cylinder( - center=(0, 0, 0), direction=(0, 1, 0), radius=0.2, height=2 - ).triangulate() + from ansys.mapdl.core.plotting_defaults import DefaultSymbol - model_c = pv.Cylinder( - center=(0, 0, 0), direction=(0, 0, 1), radius=0.2, height=2 - ).triangulate() - - result = model_a.merge(model_b).triangulate() - result = result.merge(model_c) - - result.rotate_z(45.0, inplace=True) - result.rotate_vector( - vector=(1, -1, 0), angle=-45, point=(0, 0, 0), inplace=True - ) - - return result - - VOLT = get_VOLT() - - HEAT = pv.Cube(center=(0, 0, 0), x_length=1.0, y_length=1.0, z_length=1.0) - - BC_plot_settings = { - "TEMP": {"color": "orange", "glyph": TEMP}, - "HEAT": {"color": "red", "glyph": HEAT}, - "UX": {"color": "red", "glyph": UX}, - "UY": {"color": "green", "glyph": UY}, - "UZ": {"color": "blue", "glyph": UZ}, - "VOLT": {"color": "yellow", "glyph": VOLT}, - "FX": {"color": "red", "glyph": FX}, - "FY": {"color": "green", "glyph": FY}, - "FZ": {"color": "blue", "glyph": FZ}, - "AMPS": {"color": "grey", "glyph": VOLT}, - "CHRGS": {"color": "grey", "glyph": VOLT}, - } + BC_plot_settings = DefaultSymbol() # Using * to force all the following arguments to be keyword only. @@ -750,7 +668,7 @@ def general_plotter( * **'electrical'** To plot the following electrical boundary conditions: - 'VOLT', 'CHRGS', and 'AMPS'. + 'VOLT', 'CHRG', and 'AMPS'. Defaults to all the allowed boundary conditions present in the responses of :func:`ansys.mapdl.core.Mapdl.dlist` @@ -827,7 +745,7 @@ def general_plotter( +------------+--------------------------------------+ | THERMAL | ["TEMP", "HEAT"] | +------------+--------------------------------------+ - | ELECTRICAL | ["VOLT", "CHRGS", "AMPS"] | + | ELECTRICAL | ["VOLT", "CHRG", "AMPS"] | +------------+--------------------------------------+ Examples @@ -985,6 +903,9 @@ def bc_plotter( else: bc_labels = _bc_labels_default(mapdl) + if not bc_labels: + return pl + if bc_target: bc_target = _bc_target_checker(bc_target) else: @@ -1001,10 +922,11 @@ def bc_plotter( bc_glyph_size = get_bounding_box(mapdl.mesh.nodes) bc_glyph_size = bc_glyph_size[bc_glyph_size != 0] + ratio = 0.075 # Because a glyph of 1 is too big. if bc_glyph_size.size != 0: - bc_glyph_size = bc_glyph_size.mean() * 0.75 / 10 + bc_glyph_size = bc_glyph_size.mean() * ratio else: # Case were there is only one node - bc_glyph_size = 1 + bc_glyph_size = ratio if not isinstance(bc_glyph_size, (int, float)): raise ValueError("The 'bc_glyph_size' parameter can be only an int or float.") @@ -1080,18 +1002,19 @@ def bc_nodes_plotter( orient=False, scale="scale", # tolerance=0.05, - geom=BC_plot_settings[each_label]["glyph"], + geom=BC_plot_settings(each_label)["glyph"], ) name_ = f"{each_label}" pl.add_mesh( glyphs, - color=BC_plot_settings[each_label]["color"], + color=BC_plot_settings(each_label)["color"], style="surface", # style='wireframe', - # edge_color=BC_plot_settings[each_label]['color'], + # edge_color=BC_plot_settings(each_label)['color'], # line_width=3, name=name_, label=name_, + opacity=0.50, ) if plot_bc_labels: @@ -1116,9 +1039,41 @@ def bc_nodes_plotter( pcloud["labels"], shape_opacity=0.25, font_size=bc_labels_font_size, + # There is a conflict here. See + # To do not hide the labels, even when the underlying nodes + # are hidden, we set "always_visible" + always_visible=True, + show_points=False, # to not have node duplicity ) if plot_bc_legend: + # Reorder labels to keep a consistent order + sorted_dict = OrderedDict() + labels_ = pl.renderer._labels.copy() + + # sorting the keys + for symbol in FIELDS_ORDERED_LABELS: + for key, value in labels_.items(): + # taking advantage and overriding the legend glyph with + # something it can be seen properly in the legend + label_ = value[1] + if "U" in label_: + value = [BC_plot_settings("UY")["glyph"], label_, value[2]] + elif "F" in label_: + value = [BC_plot_settings("FX")["glyph"], label_, value[2]] + else: + value = [BC_plot_settings(label_)["glyph"], label_, value[2]] + + if symbol == value[1]: + sorted_dict[key] = value + + # moving the not added labels (just in case) + for key, value in labels_.items(): + if label_ not in FIELDS_ORDERED_LABELS: + sorted_dict[key] = value + + # overwriting labels + pl.renderer._labels = sorted_dict pl.add_legend(bcolor=None) return pl diff --git a/src/ansys/mapdl/core/plotting_defaults.py b/src/ansys/mapdl/core/plotting_defaults.py new file mode 100644 index 0000000000..0d723b7652 --- /dev/null +++ b/src/ansys/mapdl/core/plotting_defaults.py @@ -0,0 +1,161 @@ +# Copyright (C) 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import pyvista as pv +from pyvista.core import _vtk_core as _vtk +from pyvista.core.utilities import translate +from pyvista.core.utilities.helpers import wrap +from pyvista.core.utilities.misc import no_new_attr + +# I dont want to have to fix a very recent lower bound for pyvista. +# Hence I'm copying what I need from there. +# copied from pyvista source code: +# https://github.com/pyvista/pyvista/blob/35396c2e7645a6b57ad30d25ac1893f2141aab95/pyvista/core/utilities/geometric_sources.py#L2254 + + +@no_new_attr +class ArrowSource(_vtk.vtkArrowSource): + def __init__( + self, + tip_length=0.25, + tip_radius=0.1, + tip_resolution=20, + shaft_radius=0.05, + shaft_resolution=20, + ): + """Initialize source.""" + self.SetTipLength(tip_length) + self.SetTipRadius(tip_radius) + self.SetTipResolution(tip_resolution) + self.SetShaftResolution(shaft_resolution) + self.SetShaftRadius(shaft_radius) + + @property + def output(self): + """Get the output data object for a port on this algorithm. + + Returns + ------- + pyvista.PolyData + Plane mesh. + """ + self.Update() + return wrap(self.GetOutput()) + + +# Symbols for constrains +class DefaultSymbol: + # Class to store the symbols because of https://github.com/ansys/pymapdl/issues/2872 + # To solve that issue, we avoid having to load the pyvista attributes when the module is load. + # Instead we set the parameters at calling + + def __init__(self): + self._configured = False + + def __call__(self, name): + if not self._configured: + self._set_configuration() + self._configured = True + + return getattr(self, name) + + def _set_configuration(self): + self._point = pv.Sphere(center=(0, 0, 0), radius=0.5) + self._cube = pv.Cube(center=(0, 0, 0), x_length=1, y_length=1, z_length=1) + + def _basic_arrow( + start=(0.0, 0.0, 0.0), + direction=(1.0, 0.0, 0.0), + tip_length=0.5, + tip_radius=0.25, + tip_resolution=20, + shaft_radius=0.05, + shaft_resolution=20, + invert=True, + ): + arrow = ArrowSource( + tip_length=tip_length, + tip_radius=tip_radius, + tip_resolution=tip_resolution, + shaft_radius=shaft_radius, + shaft_resolution=shaft_resolution, + ) + arrow.SetInvert(invert) + surf = arrow.output + + translate(surf, start, direction) + return surf + + def _arrow(*args, **kwargs): + return _basic_arrow(*args, **kwargs) + + def _cone(start=(0, 0, 0), direction=None): + return _basic_arrow( + start=start, + direction=direction, + tip_length=1, + tip_radius=0.5, + ) + + self.TEMP = { + "color": "orange", + "glyph": self._point, + } + + self.HEAT = {"color": "red", "glyph": self._cube} + + self.UX = {"color": "red", "glyph": _cone(direction=(-1, 0, 0))} + self.UY = {"color": "green", "glyph": _cone(direction=(0, -1, 0))} + self.UZ = {"color": "blue", "glyph": _cone(direction=(0, 0, -1))} + + self.FX = {"color": "red", "glyph": _arrow(direction=(-1, 0, 0))} + self.FY = {"color": "green", "glyph": _arrow(direction=(0, -1, 0))} + self.FZ = {"color": "blue", "glyph": _arrow(direction=(0, 0, -1))} + + self.VOLT = {"color": "yellow", "glyph": self.cross_cylinders_3d()} + + self.AMPS = {"color": "red", "glyph": self.cross_cylinders_3d()} + self.CHRG = {"color": "red", "glyph": self.cross_cylinders_3d()} + + @staticmethod + def cross_cylinders_3d(): + model_a = pv.Cylinder( + center=(0, 0, 0), direction=(1, 0, 0), radius=0.2, height=1.5 + ).triangulate() + + model_b = pv.Cylinder( + center=(0, 0, 0), direction=(0, 1, 0), radius=0.2, height=1.5 + ).triangulate() + + model_c = pv.Cylinder( + center=(0, 0, 0), direction=(0, 0, 1), radius=0.2, height=1.5 + ).triangulate() + + result = model_a.merge(model_b).triangulate() + result = result.merge(model_c) + + result.rotate_z(45.0, inplace=True) + result.rotate_vector( + vector=(1, -1, 0), angle=-45, point=(0, 0, 0), inplace=True + ) + + return result diff --git a/src/ansys/mapdl/core/pool.py b/src/ansys/mapdl/core/pool.py index 7bf540916d..b3f29ae45d 100755 --- a/src/ansys/mapdl/core/pool.py +++ b/src/ansys/mapdl/core/pool.py @@ -25,12 +25,16 @@ import shutil import tempfile import time -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, Union import warnings from ansys.mapdl.core import LOG, launch_mapdl from ansys.mapdl.core.errors import MapdlRuntimeError, VersionError -from ansys.mapdl.core.launcher import MAPDL_DEFAULT_PORT, port_in_use +from ansys.mapdl.core.launcher import ( + MAPDL_DEFAULT_PORT, + get_start_instance, + port_in_use, +) from ansys.mapdl.core.mapdl_grpc import _HAS_TQDM from ansys.mapdl.core.misc import create_temp_dir, threaded, threaded_daemon @@ -67,7 +71,7 @@ def available_ports(n_ports: int, starting_port: int = MAPDL_DEFAULT_PORT) -> Li return ports -class LocalMapdlPool: +class MapdlPool: """Create a pool of MAPDL instances. .. note:: @@ -114,17 +118,23 @@ class LocalMapdlPool: the index of each instance in the pool. By default, the instances directories are named as "Instances_{i}". + start_instance : bool, optional + Set it to ``False`` to make PyMAPDL to connect to remote instances instead + of launching them. In that case, you need to supply the MAPDL instances + ports as a list of ``int`` s. + **kwargs : dict, optional - Additional keyword arguments. For a complete listing, see the description for the - :func:`ansys.mapdl.core.launcher.launch_mapdl` method. + Additional keyword arguments. For a complete listing, see the + description for the :func:`ansys.mapdl.core.launcher.launch_mapdl` + method. Examples -------- Simply create a pool of 10 instances to run in the temporary directory. - >>> from ansys.mapdl.core import LocalMapdlPool - >>> pool = LocalMapdlPool(10) + >>> from ansys.mapdl.core import MapdlPool + >>> pool = MapdlPool(10) Creating Pool: 100%|########| 10/10 [00:01<00:00, 1.43it/s] Create several instances with 1 CPU each running at the current @@ -132,19 +142,19 @@ class LocalMapdlPool: >>> import os >>> my_path = os.getcmd() - >>> pool = LocalMapdlPool(10, nproc=1, run_location=my_path) + >>> pool = MapdlPool(10, nproc=1, run_location=my_path) Creating Pool: 100%|########| 10/10 [00:01<00:00, 1.43it/s] Create a pool while specifying the MAPDL executable in Windows. >>> exec_file = 'C:/Program Files/ANSYS Inc/v212/ansys/bin/winx64/ANSYS212.exe' - >>> pool = LocalMapdlPool(10, exec_file=exec_file) + >>> pool = MapdlPool(10, exec_file=exec_file) Creating Pool: 100%|########| 10/10 [00:01<00:00, 1.43it/s] Create a pool while specifying the MAPDL executable in Linux. >>> exec_file = '/ansys_inc/v211/ansys/bin/ansys211' - >>> pool = LocalMapdlPool(10, exec_file=exec_file) + >>> pool = MapdlPool(10, exec_file=exec_file) Creating Pool: 100%|########| 10/10 [00:01<00:00, 1.43it/s] """ @@ -154,12 +164,14 @@ def __init__( n_instances: int, wait: bool = True, run_location: Optional[str] = None, - port: int = MAPDL_DEFAULT_PORT, + port: Union[int, List[int]] = MAPDL_DEFAULT_PORT, progress_bar: bool = DEFAULT_PROGRESS_BAR, restart_failed: bool = True, remove_temp_files: bool = True, names: Optional[str] = None, override=True, + start_instance: bool = None, + exec_file: Optional[str] = None, **kwargs, ) -> None: """Initialize several instances of mapdl""" @@ -176,6 +188,11 @@ def __init__( self._exiting_i: int = 0 self._override = override + # Getting start_instance + start_instance = get_start_instance(start_instance) + self._start_instance = start_instance + LOG.debug(f"'start_instance' equals to '{start_instance}'") + if not names: names = "Instance" @@ -188,35 +205,56 @@ def __init__( "Only strings or functions are allowed in the argument 'name'." ) - # verify that mapdl is 2021R1 or newer - if "exec_file" in kwargs: - exec_file = kwargs["exec_file"] - else: # get default executable - if _HAS_ATP: - exec_file = get_ansys_path() - else: - raise ValueError( - "Please use 'exec_file' argument to specify the location of the ansys installation.\n" - "Alternatively, PyMAPDL can detect your ansys installation if you install 'ansys-tools-path' library." - ) + # verify executable + exec_file = os.getenv("PYMAPDL_MAPDL_EXEC", exec_file) - if exec_file is None: - raise FileNotFoundError( - "Invalid exec_file path or cannot load cached " - "ansys path. Enter one manually using " - "exec_file=" - ) + if start_instance: + exec_file = kwargs.get("exec_file", exec_file) + + if not exec_file: # get default executable + if _HAS_ATP: + exec_file = get_ansys_path() + else: + raise ValueError( + "Please use 'exec_file' argument to specify the location of the ansys installation.\n" + "Alternatively, PyMAPDL can detect your ansys installation if you install 'ansys-tools-path' library." + ) + + if exec_file is None: + raise FileNotFoundError( + "Invalid exec_file path or cannot load cached " + "ansys path. Enter one manually using " + "exec_file=" + ) - if _HAS_ATP: - if version_from_path("mapdl", exec_file) < 211: - raise VersionError("LocalMapdlPool requires MAPDL 2021R1 or later.") + # Checking version + if _HAS_ATP: + if version_from_path("mapdl", exec_file) < 211: + raise VersionError("MapdlPool requires MAPDL 2021R1 or later.") + + self._exec_file = exec_file # grab available ports - ports = available_ports(n_instances, port) + if start_instance: + if isinstance(port, int) or len(port) == 1: + ports = available_ports(n_instances, port) + else: + ports = port - if self._root_dir is not None: - if not os.path.isdir(self._root_dir): - os.makedirs(self._root_dir) + if self._root_dir is not None: + if not os.path.isdir(self._root_dir): + os.makedirs(self._root_dir) + else: + if isinstance(port, int) or len(port) == 1: + ports = [port + i for i in range(n_instances)] + else: + ports = port + + if len(ports) != n_instances: + raise ValueError( + "The number of instances should be the same as the number of ports." + ) + LOG.debug(f"Using ports: {ports}") self._instances = [] self._active = True # used by pool monitor @@ -241,7 +279,13 @@ def __init__( # threaded spawn threads = [ self._spawn_mapdl( - i, ports[i], pbar, name=self._names(i), thread_name=self._names(i) + i, + ports[i], + pbar, + name=self._names(i), + thread_name=self._names(i), + start_instance=start_instance, + exec_file=exec_file, ) for i in range(n_instances) ] @@ -612,8 +656,6 @@ def next_available(self, return_index=False): return instance, i else: return instance - else: - instance._exited = True def __del__(self): self.exit() @@ -688,7 +730,13 @@ def __iter__(self): @threaded_daemon def _spawn_mapdl( - self, index: int, port: int = None, pbar: Optional[bool] = None, name: str = "" + self, + index: int, + port: int = None, + pbar: Optional[bool] = None, + name: str = "", + start_instance=True, + exec_file=None, ): """Spawn a mapdl instance at an index""" # create a new temporary directory for each instance @@ -697,9 +745,11 @@ def _spawn_mapdl( run_location = create_temp_dir(self._root_dir, name=name) self._instances[index] = launch_mapdl( + exec_file=exec_file, run_location=run_location, port=port, override=True, + start_instance=start_instance, **self._spawn_kwargs, ) @@ -726,20 +776,21 @@ def _monitor_pool(self, refresh=1.0): """ while self._active: for index, instance in enumerate(self._instances): - name = self._names[index] + name = self._names(index) if not instance: # encountered placeholder continue if instance._exited: try: - # use the next port after the current available port self._spawning_i += 1 - port = max(self._ports) + 1 + self._spawn_mapdl( index, - port=port, + port=instance.port, name=name, thread_name=name, + exec_file=self._exec_file, + start_instance=self._start_instance, ).join() except Exception as e: diff --git a/src/ansys/mapdl/core/theme.py b/src/ansys/mapdl/core/theme.py index 77798ee18c..fcb775d719 100644 --- a/src/ansys/mapdl/core/theme.py +++ b/src/ansys/mapdl/core/theme.py @@ -48,15 +48,11 @@ else: # older versions from pyvista.themes import DefaultTheme as Theme - base_class = Theme - else: # pragma: no cover - class myEmptyClass: + class Theme: pass - base_class = myEmptyClass - MAPDL_colorbar = ( np.array( @@ -88,15 +84,8 @@ def get_ansys_colors(N=9): return np.array([PyMAPDL_cmap(i) for i in range(N)]) -class MapdlTheme(base_class): - """PyMAPDL-specific theme for pyvista. - - Theme includes the following defaults: - - - ``'jet'`` (rainbow) colormap - - Interactive plots - - ``'Courier'`` for the font family - - ``'PyMAPDL'`` as the plot title +class MapdlTheme(Theme): + """PyMAPDL-specific theme for Pyvista. Examples -------- @@ -131,14 +120,15 @@ def __init__(self): if _HAS_MATPLOTLIB: self.cmap = PyMAPDL_cmap - self.font.size = 18 - self.font.title_size = 18 - self.font.label_size = 18 - self.font.color = "black" + self.font.size = 18 + self.font.title_size = 18 + self.font.label_size = 18 + self.font.color = "black" + self.font.family = "arial" - self.axes.x_color = "tomato" - self.axes.y_color = "seagreen" - self.axes.z_color = "blue" + self.axes.x_color = "tomato" + self.axes.y_color = "seagreen" + self.axes.z_color = "blue" self.show_edges = False self.color = "lightblue" diff --git a/tests/.image_cache/bc_plot_options[False-False-False].png b/tests/.image_cache/bc_plot_options[False-False-False].png index 996436574d..8387e03497 100644 Binary files a/tests/.image_cache/bc_plot_options[False-False-False].png and b/tests/.image_cache/bc_plot_options[False-False-False].png differ diff --git a/tests/.image_cache/bc_plot_options[False-False-True].png b/tests/.image_cache/bc_plot_options[False-False-True].png index 996436574d..8387e03497 100644 Binary files a/tests/.image_cache/bc_plot_options[False-False-True].png and b/tests/.image_cache/bc_plot_options[False-False-True].png differ diff --git a/tests/.image_cache/bc_plot_options[False-True-False].png b/tests/.image_cache/bc_plot_options[False-True-False].png index 44a47a91f7..1691ec9d84 100644 Binary files a/tests/.image_cache/bc_plot_options[False-True-False].png and b/tests/.image_cache/bc_plot_options[False-True-False].png differ diff --git a/tests/.image_cache/bc_plot_options[False-True-True].png b/tests/.image_cache/bc_plot_options[False-True-True].png index 44a47a91f7..1691ec9d84 100644 Binary files a/tests/.image_cache/bc_plot_options[False-True-True].png and b/tests/.image_cache/bc_plot_options[False-True-True].png differ diff --git a/tests/.image_cache/bc_plot_options[True-False-False].png b/tests/.image_cache/bc_plot_options[True-False-False].png index 491c8d3f1f..98c91f05ff 100644 Binary files a/tests/.image_cache/bc_plot_options[True-False-False].png and b/tests/.image_cache/bc_plot_options[True-False-False].png differ diff --git a/tests/.image_cache/bc_plot_options[True-False-True].png b/tests/.image_cache/bc_plot_options[True-False-True].png index 491c8d3f1f..98c91f05ff 100644 Binary files a/tests/.image_cache/bc_plot_options[True-False-True].png and b/tests/.image_cache/bc_plot_options[True-False-True].png differ diff --git a/tests/.image_cache/bc_plot_options[True-True-False].png b/tests/.image_cache/bc_plot_options[True-True-False].png index 34618379b7..a79cd718d3 100644 Binary files a/tests/.image_cache/bc_plot_options[True-True-False].png and b/tests/.image_cache/bc_plot_options[True-True-False].png differ diff --git a/tests/.image_cache/bc_plot_options[True-True-True].png b/tests/.image_cache/bc_plot_options[True-True-True].png index 34618379b7..a79cd718d3 100644 Binary files a/tests/.image_cache/bc_plot_options[True-True-True].png and b/tests/.image_cache/bc_plot_options[True-True-True].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads0-field0].png b/tests/.image_cache/bc_plot_options_fields[loads0-field0].png new file mode 100644 index 0000000000..b9337aede2 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads0-field0].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads0-field1].png b/tests/.image_cache/bc_plot_options_fields[loads0-field1].png new file mode 100644 index 0000000000..e8f590a8be Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads0-field1].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads0-field2].png b/tests/.image_cache/bc_plot_options_fields[loads0-field2].png new file mode 100644 index 0000000000..f3139d4c6c Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads0-field2].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads0-field3].png b/tests/.image_cache/bc_plot_options_fields[loads0-field3].png new file mode 100644 index 0000000000..f723a74556 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads0-field3].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads0-field4].png b/tests/.image_cache/bc_plot_options_fields[loads0-field4].png new file mode 100644 index 0000000000..9becf8b784 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads0-field4].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads0-field5].png b/tests/.image_cache/bc_plot_options_fields[loads0-field5].png new file mode 100644 index 0000000000..c7b476c1e6 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads0-field5].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads1-field0].png b/tests/.image_cache/bc_plot_options_fields[loads1-field0].png new file mode 100644 index 0000000000..b82b5199db Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads1-field0].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads1-field1].png b/tests/.image_cache/bc_plot_options_fields[loads1-field1].png new file mode 100644 index 0000000000..d57460385c Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads1-field1].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads1-field2].png b/tests/.image_cache/bc_plot_options_fields[loads1-field2].png new file mode 100644 index 0000000000..b484f198af Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads1-field2].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads1-field3].png b/tests/.image_cache/bc_plot_options_fields[loads1-field3].png new file mode 100644 index 0000000000..d7f1f551d1 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads1-field3].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads1-field4].png b/tests/.image_cache/bc_plot_options_fields[loads1-field4].png new file mode 100644 index 0000000000..b2fecca7fb Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads1-field4].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads1-field5].png b/tests/.image_cache/bc_plot_options_fields[loads1-field5].png new file mode 100644 index 0000000000..057b57c611 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads1-field5].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads2-field0].png b/tests/.image_cache/bc_plot_options_fields[loads2-field0].png new file mode 100644 index 0000000000..6773e21342 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads2-field0].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads2-field1].png b/tests/.image_cache/bc_plot_options_fields[loads2-field1].png new file mode 100644 index 0000000000..d57460385c Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads2-field1].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads2-field2].png b/tests/.image_cache/bc_plot_options_fields[loads2-field2].png new file mode 100644 index 0000000000..b484f198af Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads2-field2].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads2-field3].png b/tests/.image_cache/bc_plot_options_fields[loads2-field3].png new file mode 100644 index 0000000000..88347bb411 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads2-field3].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads2-field4].png b/tests/.image_cache/bc_plot_options_fields[loads2-field4].png new file mode 100644 index 0000000000..b2fecca7fb Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads2-field4].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads2-field5].png b/tests/.image_cache/bc_plot_options_fields[loads2-field5].png new file mode 100644 index 0000000000..057b57c611 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads2-field5].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads3-field0].png b/tests/.image_cache/bc_plot_options_fields[loads3-field0].png new file mode 100644 index 0000000000..53513a247b Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads3-field0].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads3-field1].png b/tests/.image_cache/bc_plot_options_fields[loads3-field1].png new file mode 100644 index 0000000000..d57460385c Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads3-field1].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads3-field2].png b/tests/.image_cache/bc_plot_options_fields[loads3-field2].png new file mode 100644 index 0000000000..b484f198af Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads3-field2].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads3-field3].png b/tests/.image_cache/bc_plot_options_fields[loads3-field3].png new file mode 100644 index 0000000000..eab817c123 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads3-field3].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads3-field4].png b/tests/.image_cache/bc_plot_options_fields[loads3-field4].png new file mode 100644 index 0000000000..b2fecca7fb Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads3-field4].png differ diff --git a/tests/.image_cache/bc_plot_options_fields[loads3-field5].png b/tests/.image_cache/bc_plot_options_fields[loads3-field5].png new file mode 100644 index 0000000000..057b57c611 Binary files /dev/null and b/tests/.image_cache/bc_plot_options_fields[loads3-field5].png differ diff --git a/tests/.image_cache/single_glyph[0-CHRG].png b/tests/.image_cache/single_glyph[0-CHRG].png new file mode 100644 index 0000000000..f43b7c9c75 Binary files /dev/null and b/tests/.image_cache/single_glyph[0-CHRG].png differ diff --git a/tests/.image_cache/single_glyph[0-FX].png b/tests/.image_cache/single_glyph[0-FX].png new file mode 100644 index 0000000000..5db283d5cf Binary files /dev/null and b/tests/.image_cache/single_glyph[0-FX].png differ diff --git a/tests/.image_cache/single_glyph[0-FY].png b/tests/.image_cache/single_glyph[0-FY].png new file mode 100644 index 0000000000..be42003b13 Binary files /dev/null and b/tests/.image_cache/single_glyph[0-FY].png differ diff --git a/tests/.image_cache/single_glyph[0-FZ].png b/tests/.image_cache/single_glyph[0-FZ].png new file mode 100644 index 0000000000..0785039a90 Binary files /dev/null and b/tests/.image_cache/single_glyph[0-FZ].png differ diff --git a/tests/.image_cache/single_glyph[0-HEAT].png b/tests/.image_cache/single_glyph[0-HEAT].png new file mode 100644 index 0000000000..efa2004eda Binary files /dev/null and b/tests/.image_cache/single_glyph[0-HEAT].png differ diff --git a/tests/.image_cache/single_glyph[0-TEMP].png b/tests/.image_cache/single_glyph[0-TEMP].png new file mode 100644 index 0000000000..9203b1ceec Binary files /dev/null and b/tests/.image_cache/single_glyph[0-TEMP].png differ diff --git a/tests/.image_cache/single_glyph[0-UX].png b/tests/.image_cache/single_glyph[0-UX].png new file mode 100644 index 0000000000..6ff4c997cc Binary files /dev/null and b/tests/.image_cache/single_glyph[0-UX].png differ diff --git a/tests/.image_cache/single_glyph[0-UY].png b/tests/.image_cache/single_glyph[0-UY].png new file mode 100644 index 0000000000..8091d39f97 Binary files /dev/null and b/tests/.image_cache/single_glyph[0-UY].png differ diff --git a/tests/.image_cache/single_glyph[0-UZ].png b/tests/.image_cache/single_glyph[0-UZ].png new file mode 100644 index 0000000000..7a7bdf1fdc Binary files /dev/null and b/tests/.image_cache/single_glyph[0-UZ].png differ diff --git a/tests/.image_cache/single_glyph[0-VOLT].png b/tests/.image_cache/single_glyph[0-VOLT].png new file mode 100644 index 0000000000..442065721d Binary files /dev/null and b/tests/.image_cache/single_glyph[0-VOLT].png differ diff --git a/tests/.image_cache/single_glyph[50-CHRG].png b/tests/.image_cache/single_glyph[50-CHRG].png new file mode 100644 index 0000000000..8ae8019cfb Binary files /dev/null and b/tests/.image_cache/single_glyph[50-CHRG].png differ diff --git a/tests/.image_cache/single_glyph[50-FX].png b/tests/.image_cache/single_glyph[50-FX].png new file mode 100644 index 0000000000..da14cb0de0 Binary files /dev/null and b/tests/.image_cache/single_glyph[50-FX].png differ diff --git a/tests/.image_cache/single_glyph[50-FY].png b/tests/.image_cache/single_glyph[50-FY].png new file mode 100644 index 0000000000..d971b33384 Binary files /dev/null and b/tests/.image_cache/single_glyph[50-FY].png differ diff --git a/tests/.image_cache/single_glyph[50-FZ].png b/tests/.image_cache/single_glyph[50-FZ].png new file mode 100644 index 0000000000..2756a06002 Binary files /dev/null and b/tests/.image_cache/single_glyph[50-FZ].png differ diff --git a/tests/.image_cache/single_glyph[50-HEAT].png b/tests/.image_cache/single_glyph[50-HEAT].png new file mode 100644 index 0000000000..f790aa62af Binary files /dev/null and b/tests/.image_cache/single_glyph[50-HEAT].png differ diff --git a/tests/.image_cache/single_glyph[50-TEMP].png b/tests/.image_cache/single_glyph[50-TEMP].png new file mode 100644 index 0000000000..8710eec33b Binary files /dev/null and b/tests/.image_cache/single_glyph[50-TEMP].png differ diff --git a/tests/.image_cache/single_glyph[50-UX].png b/tests/.image_cache/single_glyph[50-UX].png new file mode 100644 index 0000000000..a12c16ce5f Binary files /dev/null and b/tests/.image_cache/single_glyph[50-UX].png differ diff --git a/tests/.image_cache/single_glyph[50-UY].png b/tests/.image_cache/single_glyph[50-UY].png new file mode 100644 index 0000000000..54012e50b8 Binary files /dev/null and b/tests/.image_cache/single_glyph[50-UY].png differ diff --git a/tests/.image_cache/single_glyph[50-UZ].png b/tests/.image_cache/single_glyph[50-UZ].png new file mode 100644 index 0000000000..142a11e8aa Binary files /dev/null and b/tests/.image_cache/single_glyph[50-UZ].png differ diff --git a/tests/.image_cache/single_glyph[50-VOLT].png b/tests/.image_cache/single_glyph[50-VOLT].png new file mode 100644 index 0000000000..308001fa59 Binary files /dev/null and b/tests/.image_cache/single_glyph[50-VOLT].png differ diff --git a/tests/.image_cache/single_glyph[500-CHRG].png b/tests/.image_cache/single_glyph[500-CHRG].png new file mode 100644 index 0000000000..ecb69c6c3f Binary files /dev/null and b/tests/.image_cache/single_glyph[500-CHRG].png differ diff --git a/tests/.image_cache/single_glyph[500-FX].png b/tests/.image_cache/single_glyph[500-FX].png new file mode 100644 index 0000000000..9e7936cd24 Binary files /dev/null and b/tests/.image_cache/single_glyph[500-FX].png differ diff --git a/tests/.image_cache/single_glyph[500-FY].png b/tests/.image_cache/single_glyph[500-FY].png new file mode 100644 index 0000000000..e057eef39a Binary files /dev/null and b/tests/.image_cache/single_glyph[500-FY].png differ diff --git a/tests/.image_cache/single_glyph[500-FZ].png b/tests/.image_cache/single_glyph[500-FZ].png new file mode 100644 index 0000000000..f66d99ef62 Binary files /dev/null and b/tests/.image_cache/single_glyph[500-FZ].png differ diff --git a/tests/.image_cache/single_glyph[500-HEAT].png b/tests/.image_cache/single_glyph[500-HEAT].png new file mode 100644 index 0000000000..4670cd8049 Binary files /dev/null and b/tests/.image_cache/single_glyph[500-HEAT].png differ diff --git a/tests/.image_cache/single_glyph[500-TEMP].png b/tests/.image_cache/single_glyph[500-TEMP].png new file mode 100644 index 0000000000..eabc2cc6b5 Binary files /dev/null and b/tests/.image_cache/single_glyph[500-TEMP].png differ diff --git a/tests/.image_cache/single_glyph[500-UX].png b/tests/.image_cache/single_glyph[500-UX].png new file mode 100644 index 0000000000..e394516df9 Binary files /dev/null and b/tests/.image_cache/single_glyph[500-UX].png differ diff --git a/tests/.image_cache/single_glyph[500-UY].png b/tests/.image_cache/single_glyph[500-UY].png new file mode 100644 index 0000000000..0c09f188da Binary files /dev/null and b/tests/.image_cache/single_glyph[500-UY].png differ diff --git a/tests/.image_cache/single_glyph[500-UZ].png b/tests/.image_cache/single_glyph[500-UZ].png new file mode 100644 index 0000000000..5c4ad4f8a9 Binary files /dev/null and b/tests/.image_cache/single_glyph[500-UZ].png differ diff --git a/tests/.image_cache/single_glyph[500-VOLT].png b/tests/.image_cache/single_glyph[500-VOLT].png new file mode 100644 index 0000000000..c885e5216d Binary files /dev/null and b/tests/.image_cache/single_glyph[500-VOLT].png differ diff --git a/tests/common.py b/tests/common.py index ebb65b315d..29f0eb492c 100644 --- a/tests/common.py +++ b/tests/common.py @@ -104,7 +104,7 @@ def has_grpc(): def has_dpf(): - return os.environ.get("DPF_PORT", "") + return bool(os.environ.get("DPF_PORT", "")) def is_smp(): diff --git a/tests/conftest.py b/tests/conftest.py index fb7145adc2..63c4631e3f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,6 +23,7 @@ from collections import namedtuple import os from pathlib import Path +from shutil import get_terminal_size from sys import platform from _pytest.terminal import TerminalReporter # for terminal customization @@ -204,7 +205,12 @@ def requires_dependency(dependency: str): pymapdl.RUNNING_TESTS = True -from ansys.mapdl.core.errors import MapdlExitedError, MapdlRuntimeError +from ansys.mapdl.core import Mapdl +from ansys.mapdl.core.errors import ( + MapdlConnectionError, + MapdlExitedError, + MapdlRuntimeError, +) from ansys.mapdl.core.examples import vmfiles from ansys.mapdl.core.launcher import get_start_instance, launch_mapdl @@ -238,6 +244,38 @@ def requires_dependency(dependency: str): raise MapdlRuntimeError(ERRMSG) +@pytest.hookimpl(trylast=True) +def pytest_report_header(config, start_path, startdir): + text = [] + text += ["Testing variables".center(get_terminal_size()[0], "-")] + text += [ + f"Session dependent: ON_CI ({ON_CI}), TESTING_MINIMAL ({TESTING_MINIMAL}), SUPPORT_PLOTTING ({SUPPORT_PLOTTING})" + ] + text += [ + f"OS dependent: ON_LINUX ({ON_LINUX}), ON_UBUNTU ({ON_UBUNTU}), ON_WINDOWS ({ON_WINDOWS}), ON_MACOS )({ON_MACOS})" + ] + text += [ + f"MAPDL dependent: ON_LOCAL ({ON_LOCAL}), ON_STUDENT ({ON_STUDENT}), HAS_GRPC ({HAS_GRPC}), HAS_DPF ({HAS_DPF}), IS_SMP ({IS_SMP})" + ] + + text += ["Environment variables".center(get_terminal_size()[0], "-")] + line = "" + for env_var in [ + "PYMAPDL_START_INSTANCE", + "PYMAPDL_PORT", + "PYMAPDL_DB_PORT", + "PYMAPDL_IP", + "DPF_PORT", + "DPF_START_SERVER", + ]: + env_var_value = os.environ.get(env_var, None) + if env_var_value is not None: + line += f"{env_var} ('{env_var_value}'), " + text += [line] + text += ["Pytest configuration".center(get_terminal_size()[0], "-")] + return "\n".join(text) + + ## Changing report line length class MyReporter(TerminalReporter): def short_test_summary(self): @@ -373,26 +411,32 @@ def is_exited(mapdl): except MapdlExitedError: return True - if START_INSTANCE and is_exited(mapdl): + if START_INSTANCE and (is_exited(mapdl) or mapdl._exited): # Backing up the current local configuration local_ = mapdl._local - - # Relaunching MAPDL - mapdl_ = launch_mapdl( - port=mapdl._port, - override=True, - run_location=mapdl._path, - cleanup_on_exit=mapdl._cleanup, - ) - - # Cloning the new mapdl instance channel into the old one. - mapdl._channel = mapdl_._channel - mapdl._multi_connect(timeout=mapdl._timeout) + channel = mapdl._channel + ip = mapdl.ip + port = mapdl.port + try: + # to connect + mapdl = Mapdl(port=port, ip=ip) + + except MapdlConnectionError as err: + # we cannot connect. + # Kill the instance + mapdl.exit() + + # Relaunching MAPDL + mapdl = launch_mapdl( + port=mapdl._port, + override=True, + run_location=mapdl._path, + cleanup_on_exit=mapdl._cleanup, + ) # Restoring the local configuration mapdl._local = local_ - mapdl.gopr() yield # this is where the testing happens # Teardown : fill with any logic you want diff --git a/tests/test_cli.py b/tests/test_cli.py index 9fd8b55602..12200c0e9d 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -54,11 +54,18 @@ def do_run(arguments=""): @requires("click") @requires("local") @requires("nostudent") -def test_launch_mapdl_cli(run_cli): - output = run_cli() +@pytest.mark.parametrize("start_instance", [None, True, False]) +def test_launch_mapdl_cli(monkeypatch, run_cli, start_instance): + if start_instance is not None: + monkeypatch.setenv("PYMAPDL_START_INSTANCE", str(start_instance)) + else: + monkeypatch.delenv("PYMAPDL_START_INSTANCE", raising=False) + + # Setting a port so it does not collide with the already running instance for testing + output = run_cli("start --port 50053") - # In local assert "Success: Launched an MAPDL instance " in output + assert "50053" in output # grab ips and port pid = int(re.search(r"\(PID=(\d+)\)", output).groups()[0]) @@ -127,26 +134,26 @@ def test_launch_mapdl_cli_config(run_cli): @requires("nostudent") def test_launch_mapdl_cli_list(run_cli): output = run_cli("list") - assert "running" in output + assert "running" in output or "sleeping" in output assert "Is Instance" in output assert len(output.splitlines()) > 2 assert "ansys" in output.lower() or "mapdl" in output.lower() output = run_cli("list -i") - assert "running" in output + assert "running" in output or "sleeping" in output assert "Is Instance" not in output assert len(output.splitlines()) > 2 assert "ansys" in output.lower() or "mapdl" in output.lower() output = run_cli("list -c") - assert "running" in output + assert "running" in output or "sleeping" in output assert "Command line" in output assert "Is Instance" in output assert len(output.splitlines()) > 2 assert "ansys" in output.lower() or "mapdl" in output.lower() output = run_cli("list -cwd") - assert "running" in output + assert "running" in output or "sleeping" in output assert "Command line" not in output assert "Working directory" in output assert "Is Instance" in output @@ -154,7 +161,7 @@ def test_launch_mapdl_cli_list(run_cli): assert "ansys" in output.lower() or "mapdl" in output.lower() output = run_cli("list -l") - assert "running" in output + assert "running" in output or "sleeping" in output assert "Is Instance" in output assert "Command line" in output assert len(output.splitlines()) > 2 diff --git a/tests/test_database.py b/tests/test_database.py index fe24c729d7..f045af90d8 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -28,7 +28,8 @@ ## Checking MAPDL versions from ansys.mapdl.core.database import MINIMUM_MAPDL_VERSION, DBDef, MapdlDb -from ansys.mapdl.core.errors import MapdlRuntimeError +from ansys.mapdl.core.database.database import FAILING_DATABASE_MAPDL +from ansys.mapdl.core.errors import MapdlRuntimeError, MapdlVersionError from ansys.mapdl.core.misc import random_string from conftest import ON_CI @@ -56,7 +57,7 @@ def db(mapdl): f"This MAPDL version ({mapdl_version}) docker image seems to not support DB, but local does." ) - if mapdl_version == "24.1": + if mapdl_version == "24.1" or mapdl_version == "24.2": pytest.skip( f"This MAPDL version ({mapdl_version}) does not support PyMAPDL Database." ) @@ -72,6 +73,14 @@ def db(mapdl): return mapdl.db +def test_failure_on_non_allowed_versions(mapdl): + if str(mapdl.version) in ["24.1", "24.2"]: + with pytest.raises(MapdlVersionError): + mapdl.db.start() + else: + pytest.skip(f"Should run only on MAPDL 24.1 and 24.2") + + @pytest.fixture(scope="session") def gen_block(mapdl): """Generate nodes and elements in a simple block.""" @@ -109,6 +118,11 @@ def test_database_start_stop(mapdl): f"This MAPDL version ({mapdl_version}) docker image seems to not support DB, but local does." ) + if mapdl_version in FAILING_DATABASE_MAPDL: + pytest.skip( + f"This MAPDL version ({mapdl_version}) docker image does not support Database module." + ) + # verify it can be created twice mapdl.prep7() for _ in range(2): diff --git a/tests/test_examples.py b/tests/test_examples.py index 3f1fe09998..723b417b7b 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -164,28 +164,33 @@ def test_download_tech_demo_data(running_test): @requires("requests") def test_detach_examples_submodule(): - cmd = """ + cmd = ( + """ import sys -assert "ansys.mapdl.core" not in sys.modules -assert "requests" not in sys.modules -assert "ansys.mapdl.core.examples" not in sys.modules +assert 'ansys.mapdl.core' not in sys.modules +assert 'requests' not in sys.modules +assert 'ansys.mapdl.core.examples' not in sys.modules from ansys.mapdl import core as pymapdl -assert "ansys.mapdl.core" in sys.modules -assert "ansys.mapdl.core.examples" not in sys.modules -assert "requests" not in sys.modules +assert 'ansys.mapdl.core' in sys.modules +assert 'ansys.mapdl.core.examples' not in sys.modules +assert 'requests' not in sys.modules from ansys.mapdl.core.examples import vmfiles -assert "ansys.mapdl.core.examples" in sys.modules -assert "requests" in sys.modules +assert 'ansys.mapdl.core.examples' in sys.modules +assert 'requests' in sys.modules -print("Everything went well") -""" +print('Everything went well') +""".strip() + .replace("\n", ";") + .replace(";;", ";") + ) + + cmd_line = f"""python -c "{cmd}" """ - cmd_line = f"""python -c '{cmd}' """ p = Popen(cmd_line, shell=True, stdout=PIPE, stderr=STDOUT) out = p.communicate()[0].decode() diff --git a/tests/test_launcher.py b/tests/test_launcher.py index 79a4dd8060..8f2b7d1136 100644 --- a/tests/test_launcher.py +++ b/tests/test_launcher.py @@ -25,6 +25,7 @@ import os import tempfile from time import sleep +import warnings import psutil import pytest @@ -38,18 +39,20 @@ PortAlreadyInUseByAnMAPDLInstance, ) from ansys.mapdl.core.launcher import ( + LOCALHOST, _check_license_argument, _force_smp_student_version, _is_ubuntu, _parse_ip_route, _validate_MPI, _verify_version, + get_start_instance, launch_grpc, launch_mapdl, update_env_vars, ) from ansys.mapdl.core.licensing import LICENSES -from conftest import ON_LOCAL, QUICK_LAUNCH_SWITCHES, requires +from conftest import ON_LOCAL, QUICK_LAUNCH_SWITCHES, NullContext, requires try: from ansys.tools.path import ( @@ -180,20 +183,21 @@ def test_launch_console(version): @requires("local") @requires("nostudent") -def test_license_type_keyword(): +def test_license_type_keyword(mapdl): checks = [] for license_name, license_description in LICENSES.items(): try: - mapdl = launch_mapdl( + mapdl_ = launch_mapdl( license_type=license_name, start_timeout=start_timeout, + port=mapdl.port + 1, additional_switches=QUICK_LAUNCH_SWITCHES, ) # Using first line to ensure not picking up other stuff. - checks.append(license_description in mapdl.__str__().split("\n")[0]) - mapdl.exit() - del mapdl + checks.append(license_description in mapdl_.__str__().split("\n")[0]) + mapdl_.exit() + del mapdl_ sleep(2) except MapdlDidNotStart as e: @@ -207,43 +211,45 @@ def test_license_type_keyword(): @requires("local") @requires("nostudent") -def test_license_type_keyword_names(): +def test_license_type_keyword_names(mapdl): # This test might became a way to check available licenses, which is not the purpose. successful_check = False for license_name, license_description in LICENSES.items(): - mapdl = launch_mapdl( + mapdl_ = launch_mapdl( license_type=license_name, start_timeout=start_timeout, + port=mapdl.port + 1, additional_switches=QUICK_LAUNCH_SWITCHES, ) # Using first line to ensure not picking up other stuff. successful_check = ( - license_description in mapdl.__str__().split("\n")[0] or successful_check + license_description in mapdl_.__str__().split("\n")[0] or successful_check ) - assert license_description in mapdl.__str__().split("\n")[0] - mapdl.exit() + assert license_description in mapdl_.__str__().split("\n")[0] + mapdl_.exit() assert successful_check # if at least one license is ok, this should be true. @requires("local") @requires("nostudent") -def test_license_type_additional_switch(): +def test_license_type_additional_switch(mapdl): # This test might became a way to check available licenses, which is not the purpose. successful_check = False for license_name, license_description in LICENSES.items(): - mapdl = launch_mapdl( + mapdl_ = launch_mapdl( additional_switches=QUICK_LAUNCH_SWITCHES + " -p " + license_name, start_timeout=start_timeout, + port=mapdl.port + 1, ) # Using first line to ensure not picking up other stuff. successful_check = ( - license_description in mapdl.__str__().split("\n")[0] or successful_check + license_description in mapdl_.__str__().split("\n")[0] or successful_check ) - mapdl.exit() + mapdl_.exit() assert successful_check # if at least one license is ok, this should be true. @@ -264,7 +270,7 @@ def test_license_type_dummy(mapdl): @requires("nostudent") def test_remove_temp_files(mapdl): """Ensure the working directory is removed when run_location is not set.""" - mapdl = launch_mapdl( + mapdl_ = launch_mapdl( port=mapdl.port + 1, remove_temp_files=True, start_timeout=start_timeout, @@ -272,8 +278,8 @@ def test_remove_temp_files(mapdl): ) # possible MAPDL is installed but running in "remote" mode - path = mapdl.directory - mapdl.exit() + path = mapdl_.directory + mapdl_.exit() tmp_dir = tempfile.gettempdir() ans_temp_dir = os.path.join(tmp_dir, "ansys_") @@ -287,17 +293,17 @@ def test_remove_temp_files(mapdl): @requires("nostudent") def test_remove_temp_files_fail(tmpdir, mapdl): """Ensure the working directory is not removed when the cwd is changed.""" - mapdl = launch_mapdl( + mapdl_ = launch_mapdl( port=mapdl.port + 1, remove_temp_files=True, start_timeout=start_timeout, additional_switches=QUICK_LAUNCH_SWITCHES, ) - old_path = mapdl.directory + old_path = mapdl_.directory assert os.path.isdir(str(tmpdir)) - mapdl.cwd(str(tmpdir)) - path = mapdl.directory - mapdl.exit() + mapdl_.cwd(str(tmpdir)) + path = mapdl_.directory + mapdl_.exit() assert os.path.isdir(path) # Checking no changes in the old path @@ -457,7 +463,7 @@ def test_version(mapdl): additional_switches=QUICK_LAUNCH_SWITCHES, _debug_no_launch=True, ) - assert str(version) in launching_arg["start_parm"]["exec_file"] + assert str(version) in str(launching_arg["version"]) @requires("local") @@ -552,3 +558,132 @@ def test_deprecate_verbose(): with pytest.raises(DeprecationError): launch_grpc(verbose=True) + + +@pytest.mark.parametrize( + "start_instance,context", + [ + pytest.param(True, NullContext(), id="Boolean true"), + pytest.param(False, NullContext(), id="Boolean false"), + pytest.param("true", NullContext(), id="String true"), + pytest.param("TRue", NullContext(), id="String true weird capitalization"), + pytest.param("2", pytest.raises(OSError), id="String number"), + pytest.param(2, pytest.raises(ValueError), id="Int"), + ], +) +def test_get_start_instance_argument(monkeypatch, start_instance, context): + if "PYMAPDL_START_INSTANCE" in os.environ: + monkeypatch.delenv("PYMAPDL_START_INSTANCE") + with context: + if "true" in str(start_instance).lower(): + assert get_start_instance(start_instance) + else: + assert not get_start_instance(start_instance) + + +@pytest.mark.parametrize( + "start_instance, context", + [ + pytest.param("true", NullContext()), + pytest.param("TRue", NullContext()), + pytest.param("False", NullContext()), + pytest.param("FaLSE", NullContext()), + pytest.param("asdf", pytest.raises(OSError)), + pytest.param("1", pytest.raises(OSError)), + pytest.param("", pytest.raises(OSError)), + ], +) +def test_get_start_instance_envvar(monkeypatch, start_instance, context): + monkeypatch.setenv("PYMAPDL_START_INSTANCE", start_instance) + with context: + if "true" in start_instance.lower(): + assert get_start_instance(start_instance) + else: + assert not get_start_instance(start_instance) + + +@pytest.mark.parametrize("start_instance", [True, False]) +def test_launcher_start_instance(monkeypatch, start_instance): + if "PYMAPDL_START_INSTANCE" in os.environ: + monkeypatch.delenv("PYMAPDL_START_INSTANCE") + options = launch_mapdl(start_instance=start_instance, _debug_no_launch=True) + assert start_instance == options["start_instance"] + + +@pytest.mark.parametrize("start_instance", [None, True, False]) +@pytest.mark.parametrize("start_instance_envvar", [None, True, False]) +@pytest.mark.parametrize("ip", [None, "", "123.1.1.1"]) +@pytest.mark.parametrize("ip_envvar", [None, "", "123.1.1.1"]) +def test_ip_and_start_instance( + monkeypatch, start_instance, start_instance_envvar, ip, ip_envvar +): + # start_instance=False + # start_instance_envvar=True + # ip="" + # ip_envvar="123.1.1.1" + + # For more information, visit https://github.com/ansys/pymapdl/issues/2910 + if "PYMAPDL_START_INSTANCE" in os.environ: + monkeypatch.delenv("PYMAPDL_START_INSTANCE") + + if start_instance_envvar is not None: + monkeypatch.setenv("PYMAPDL_START_INSTANCE", str(start_instance_envvar)) + if ip_envvar is not None: + monkeypatch.setenv("PYMAPDL_IP", str(ip_envvar)) + + start_instance_is_true = start_instance_envvar is True or ( + start_instance_envvar is None and (start_instance is True) + ) + + ip_is_true = bool(ip_envvar) or ( + (ip_envvar is None or ip_envvar == "") and bool(ip) + ) + + exceptions = start_instance_envvar is None and start_instance is None and ip_is_true + + if (start_instance_is_true and ip_is_true) and not exceptions: + with pytest.raises( + ValueError, + match="When providing a value for the argument 'ip', the argument ", + ): + options = launch_mapdl( + start_instance=start_instance, ip=ip, _debug_no_launch=True + ) + + return # Exit + + if ( + isinstance(start_instance_envvar, bool) and isinstance(start_instance, bool) + ) or (ip_envvar and ip): + with pytest.warns(UserWarning): + options = launch_mapdl( + start_instance=start_instance, ip=ip, _debug_no_launch=True + ) + else: + with warnings.catch_warnings(): + options = launch_mapdl( + start_instance=start_instance, ip=ip, _debug_no_launch=True + ) + + if start_instance_envvar is True: + assert options["start_instance"] is True + elif start_instance_envvar is False: + assert options["start_instance"] is False + else: + if start_instance is None: + if ip_envvar or bool(ip): + assert not options["start_instance"] + else: + assert options["start_instance"] + elif start_instance is True: + assert options["start_instance"] + else: + assert not options["start_instance"] + + if ip_envvar: + assert options["ip"] == ip_envvar + else: + if ip: + assert options["ip"] == ip + else: + assert options["ip"] in (LOCALHOST, "0.0.0.0") diff --git a/tests/test_licensing.py b/tests/test_licensing.py index def8e3a383..2e77a80e98 100644 --- a/tests/test_licensing.py +++ b/tests/test_licensing.py @@ -182,20 +182,21 @@ def test_license_checker(tmpdir, license_checker): @requires("local") @skip_no_lic_bin -def test_check_license_file(tmpdir): +def test_check_license_file(mapdl, tmpdir): timeout = 15 checker = licensing.LicenseChecker(timeout=timeout) # start the license check in the background checker.start(checkout_license=False) try: - mapdl = launch_mapdl( + mapdl_ = launch_mapdl( license_server_check=False, start_timeout=timeout, additional_switches=QUICK_LAUNCH_SWITCHES, + port=mapdl.port + 1, ) - assert mapdl._local - mapdl.exit() + assert mapdl_._local + mapdl_.exit() except IOError: # MAPDL never started assert not checker._license_file_success else: diff --git a/tests/test_mapdl.py b/tests/test_mapdl.py index 3c8878125a..60337e23a3 100644 --- a/tests/test_mapdl.py +++ b/tests/test_mapdl.py @@ -1266,6 +1266,7 @@ def test_get_file_path(mapdl, tmpdir): assert fobject not in mapdl.list_files() assert fobject not in os.listdir() + prev = mapdl._local mapdl._local = True fname_ = mapdl._get_file_path(fobject) assert fname in fname_ @@ -1277,6 +1278,8 @@ def test_get_file_path(mapdl, tmpdir): # If we are not in local, now it should have been uploaded assert fname in mapdl.list_files() + mapdl._local = prev + @pytest.mark.parametrize( "option2,option3,option4", @@ -1286,7 +1289,7 @@ def test_get_file_path(mapdl, tmpdir): ("expdata", "dat", "DIR"), ], ) -def test_tbft(mapdl, tmpdir, option2, option3, option4): +def test_tbft(mapdl, cleared, tmpdir, option2, option3, option4): fname = "expdata.dat" dirpath = tmpdir.mkdir("tmpdir") fpath = dirpath.join(fname) @@ -1305,12 +1308,16 @@ def test_tbft(mapdl, tmpdir, option2, option3, option4): else: option2 = os.path.join(dirpath, option2) - mapdl.prep7(mute=True) + mapdl.prep7() mat_id = mapdl.get_value("MAT", 0, "NUM", "MAX") + 1 - mapdl.tbft("FADD", mat_id, "HYPER", "MOONEY", "3", mute=True) - mapdl.tbft("EADD", mat_id, "UNIA", option2, option3, option4, "", "", "", mute=True) + output = mapdl.tbft("FADD", mat_id, "HYPER", "MOONEY", "3") + assert "Successfully Constructed Material Model" in output + output = mapdl.tbft("EADD", mat_id, "UNIA", option2, option3, option4, "", "", "") + assert "Successfully Constructed Material Model" in output - assert fname in mapdl.list_files() + # with pytest.warns(UserWarning): + # # checking warning if overwriting + # mapdl.tbft("FADD", mat_id, "HYPER", "MOONEY", "3") def test_tbft_not_found(mapdl): @@ -1485,8 +1492,9 @@ def test_mpfunctions(mapdl, cube_solve, capsys): mapdl.mpread(fname="dummy", ext="dummy", lib="something") # Test suppliying a dir path when in remote - with pytest.raises(IOError): - mapdl.mpwrite("/test_dir/test", "mp") + if not ON_LOCAL: + with pytest.raises(IOError): + mapdl.mpwrite("/test_dir/test", "mp") def test_mapdl_str(mapdl): @@ -1515,7 +1523,7 @@ def test_file_command_local(mapdl, cube_solve, tmpdir): with pytest.raises(FileNotFoundError): mapdl.file("potato") - assert rst_file in mapdl.list_files() + assert os.path.basename(rst_file) in mapdl.list_files() rst_fpath = os.path.join(mapdl.directory, rst_file) # change directory @@ -1851,7 +1859,7 @@ def test_cache_pids(mapdl): mapdl._cache_pids() # Recache pids for each in mapdl._pids: - assert "ansys" in "".join(psutil.Process(each).cmdline()) + assert "ansys" in "".join(psutil.Process(each).cmdline()).lower() @requires("local") @@ -1942,7 +1950,9 @@ def test_igesin_whitespace(mapdl, cleared, tmpdir): @requires("nostudent") def test_save_on_exit(mapdl, cleared): mapdl2 = launch_mapdl( - license_server_check=False, additional_switches=QUICK_LAUNCH_SWITCHES + license_server_check=False, + additional_switches=QUICK_LAUNCH_SWITCHES, + port=mapdl.port + 1, ) mapdl2.parameters["my_par"] = "initial_value" @@ -1957,10 +1967,12 @@ def test_save_on_exit(mapdl, cleared): mapdl2.exit() mapdl2 = launch_mapdl( - license_server_check=False, additional_switches=QUICK_LAUNCH_SWITCHES + license_server_check=False, + additional_switches=QUICK_LAUNCH_SWITCHES, + port=mapdl.port + 1, ) mapdl2.resume(db_path) - if mapdl.version >= 24.1: + if mapdl.version >= 24.2: assert mapdl2.parameters["my_par"] == "initial_value" else: # This fails in earlier versions of MAPDL @@ -1974,7 +1986,9 @@ def test_save_on_exit(mapdl, cleared): mapdl2.exit(save=True) mapdl2 = launch_mapdl( - license_server_check=False, additional_switches=QUICK_LAUNCH_SWITCHES + license_server_check=False, + additional_switches=QUICK_LAUNCH_SWITCHES, + port=mapdl.port + 1, ) mapdl2.resume(db_path) assert mapdl2.parameters["my_par"] == "new_initial_value" @@ -2244,7 +2258,7 @@ def test_inquire_invalid(mapdl): def test_inquire_default(mapdl): mapdl.title = "heeeelloo" - assert mapdl.directory == mapdl.inquire() + assert Path(mapdl.directory) == Path(mapdl.inquire()) def test_vwrite_error(mapdl): @@ -2363,3 +2377,73 @@ def test_lgwrite(mapdl, cleared, filename, ext, remove_grpc_extra, kedit): assert "LGWRITE" in content os.remove(filename_) + + +@requires("matplotlib") +@requires("grpc") +def test_screenshot(mapdl, make_block, tmpdir): + """Test screenshot capabilities""" + previous_device = mapdl.file_type_for_plots + mapdl.show("TIFF") + assert "TIFF" == mapdl.file_type_for_plots + + assert mapdl.screenshot() is None + assert "TIFF" == mapdl.file_type_for_plots + + assert mapdl.screenshot(False) is None + assert "TIFF" == mapdl.file_type_for_plots + + file_name = mapdl.screenshot(True) + assert "mapdl_screenshot_0.png" == file_name + assert "TIFF" == mapdl.file_type_for_plots + assert file_name in os.listdir(os.getcwd()) + + file_name = mapdl.screenshot(True) + assert "mapdl_screenshot_1.png" == file_name + assert "TIFF" == mapdl.file_type_for_plots + assert file_name in os.listdir(os.getcwd()) + + os.remove("mapdl_screenshot_0.png") + os.remove(file_name) + + file_name = mapdl.screenshot(str(tmpdir)) + assert "TIFF" == mapdl.file_type_for_plots + assert file_name in os.listdir(str(tmpdir)) + + dest = os.path.join(tmpdir, "myscreenshot.png") + file_name = mapdl.screenshot(dest) + assert "TIFF" == mapdl.file_type_for_plots + assert os.path.exists(dest) + + file_name = mapdl.screenshot("myscreenshot.png") + assert "TIFF" == mapdl.file_type_for_plots + assert os.path.exists(file_name) + assert os.path.exists(os.path.join(os.getcwd(), "myscreenshot.png")) + os.remove(file_name) + + mapdl.file_type_for_plots = previous_device + + +def test_force_command_ignored_not_active_set(mapdl, cleared): + mapdl.prep7() + mapdl.et("", 227) + mapdl.keyopt(1, 1) # Thermal-Piezoelectric + mapdl.n(1, 0, 0, 0) + + with pytest.raises(MapdlCommandIgnoredError): + mapdl.f(1, "CHRG", 10) + + +def test_force_command_when_no_nodes(mapdl, cleared): + mapdl.prep7() + mapdl.et(1, 189) + with pytest.raises(MapdlCommandIgnoredError, match="No nodes defined"): + mapdl.f(1, "CHRG", 0) + + +def test_not_correct_et_element(mapdl): + mapdl.clear() + mapdl.prep7() + mapdl.et(1, 227) + with pytest.warns(UserWarning, match="is normal behavior when a CDB file is used"): + mapdl.keyopt(1, 222) diff --git a/tests/test_misc.py b/tests/test_misc.py index eab0f64e3d..264da1811c 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -37,7 +37,6 @@ check_valid_ip, check_valid_port, check_valid_routine, - check_valid_start_instance, last_created, load_file, no_return, @@ -103,34 +102,6 @@ def test_check_valid_port_error(port): check_valid_port(port) -@pytest.mark.parametrize( - "start_instance", - [ - "true", - "TRue", - "False", - True, - False, - ], -) -def test_check_valid_start_instance(start_instance): - check_valid_start_instance(start_instance) - - -@pytest.mark.parametrize( - "start_instance", - [ - "asdf", - "2323", - 1, - 1e9, - ], -) -def test_check_valid_start_instance_error(start_instance): - with pytest.raises(ValueError): - check_valid_start_instance(start_instance) - - def test_creation_time(tmpdir): files_ = [] for i in range(4): diff --git a/tests/test_plotting.py b/tests/test_plotting.py index 3ec1cdbafc..c388ae1368 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -36,34 +36,83 @@ from ansys.mapdl.core.errors import ComponentDoesNotExits from ansys.mapdl.core.plotting import general_plotter +FORCE_LABELS = [["FX", "FY", "FZ"], ["HEAT"], ["CHRG"]] +DISPL_LABELS = [["UX", "UY", "UZ"], ["TEMP"], ["VOLT"]] +ALL_LABELS = FORCE_LABELS.copy() +ALL_LABELS.extend(DISPL_LABELS) + @pytest.fixture -def bc_example(mapdl, make_block): +def boundary_conditions_example(mapdl): + mapdl.clear() mapdl.prep7() + mapdl.et("", 189) + + mapdl.n(1, 0, 0, 0) + mapdl.n(2, 1, 0, 0) + mapdl.n(3, 2, 0, 0) + mapdl.n(4, 0, 0, 1) + mapdl.n(5, 1, 0, 1) + mapdl.n(6, 2, 0, 1) mapdl.nsel("s", "node", "", 1) mapdl.f("all", "FX", 0) + mapdl.nsel("s", "node", "", 2) mapdl.f("all", "FY", 0) + mapdl.nsel("s", "node", "", 3) mapdl.f("all", "FZ", 0) - mapdl.nsel("s", "node", "", 2) - mapdl.f("all", "FX", 100) - mapdl.f("all", "FY", 200) - mapdl.f("all", "FZ", 100) - - mapdl.nsel("s", "node", "", 3) + mapdl.nsel("s", "node", "", 4) mapdl.d("all", "UX", 0) + mapdl.nsel("s", "node", "", 5) mapdl.d("all", "UY", 0) + mapdl.nsel("s", "node", "", 6) mapdl.d("all", "UZ", 0) - mapdl.nsel("s", "node", "", 4) - mapdl.d("all", "UX", 1) - mapdl.d("all", "UY", 2) - mapdl.d("all", "UZ", 3) + mapdl.n(7, 0, 1, 0) + mapdl.n(8, 1, 1, 0) + mapdl.n(9, 2, 1, 0) + mapdl.n(10, 0, 2, 0) + mapdl.n(11, 1, 2, 0) + mapdl.n(12, 2, 2, 0) + + mapdl.nsel("s", "node", "", 7) + mapdl.f("all", "FX", 10) + mapdl.nsel("s", "node", "", 8) + mapdl.f("all", "FY", 20) + mapdl.nsel("s", "node", "", 9) + mapdl.f("all", "FZ", 30) + + mapdl.nsel("s", "node", "", 10) + mapdl.d("all", "UX", 20) + mapdl.nsel("s", "node", "", 11) + mapdl.d("all", "UY", 20) + mapdl.nsel("s", "node", "", 12) + mapdl.d("all", "UZ", 20) mapdl.nsel("all") +@pytest.fixture +def block_example_coupled(mapdl): + mapdl.clear() + mapdl.prep7() + + mapdl.et(1, 226) + mapdl.keyopt(1, 1, 1011) # Thermal-Piezoelectric + + # Disp + # UX, UY, UZ, + # TEMP, VOLT + + # Force + # FX, FY, FZ, + # HEAT, CHRG + mapdl.n(1, 0, 0, 0) + mapdl.n(2, 1, 0, 0) + mapdl.n(3, 2, 0, 0) + + def test_plot_empty_mesh(mapdl, cleared): with pytest.warns(UserWarning): mapdl.nplot(vtk=True) @@ -212,20 +261,59 @@ def test_eplot_savefig(mapdl, make_block, tmpdir): assert os.path.isfile(filename) +@pytest.mark.parametrize( + "field", ["UX", "UY", "UZ", "FX", "FY", "FZ", "TEMP", "HEAT", "VOLT", "CHRG"] +) +@pytest.mark.parametrize("magnitude", [0, 50, 500]) +def test_single_glyph(mapdl, field, magnitude, verify_image_cache): + mapdl.clear() + mapdl.prep7() + mapdl.et(1, 226) + mapdl.keyopt(1, 1, 1011) # Thermal-Piezoelectric + mapdl.n(1, 0, 0, 0) + + if field in [x for group in DISPL_LABELS for x in group]: + func = getattr(mapdl, "d") + else: + func = getattr(mapdl, "f") + + func(1, field, magnitude) + + if magnitude > 0: + mapdl.n(2, 1, 0, 0) + func(2, field, magnitude * 2) + + if magnitude > 50: + mapdl.n(3, 2, 0, 0) + func(3, field, magnitude * 10) + + mapdl.allsel() + + p = mapdl.nplot( + plot_bc=True, + # point_size=max(magnitude, 10), + # render_points_as_spheres=True, + plot_bc_legend=True, + plot_bc_labels=True, + title="", + ) + + @pytest.mark.parametrize("return_plotter", [True, False]) @pytest.mark.parametrize("plot_bc_legend", [True, False]) @pytest.mark.parametrize("plot_bc_labels", [True, False]) def test_bc_plot_options( mapdl, - bc_example, + boundary_conditions_example, verify_image_cache, return_plotter, plot_bc_legend, plot_bc_labels, + bc_labels_font_size=50, ): - if plot_bc_legend: - # The legend generates highly variance than other tests - # But it seems not always. + + if plot_bc_legend or plot_bc_labels: + # The legend and labels generate highly variance than other tests verify_image_cache.high_variance_test = True p = mapdl.nplot( @@ -233,6 +321,7 @@ def test_bc_plot_options( plot_bc=True, plot_bc_legend=plot_bc_legend, plot_bc_labels=plot_bc_labels, + title="", ) if return_plotter: @@ -242,6 +331,33 @@ def test_bc_plot_options( assert p is None +@pytest.mark.parametrize("field", ALL_LABELS) +@pytest.mark.parametrize( + "loads", [[0, 0, 0], [10, 10, 10], [10, 20, 30], [10, 100, 1000]] +) +def test_bc_plot_options_fields( + mapdl, block_example_coupled, verify_image_cache, field, loads +): + mapdl.prep7() + for i in range(len(field)): + mapdl.nsel("s", "node", "", i + 1) + if field[i] in [x for group in FORCE_LABELS for x in group]: + mapdl.f("all", field[i], loads[i]) + else: + mapdl.d("all", field[i], loads[i]) + + mapdl.nsel("s", "node", "", 1, 3) + + p = mapdl.nplot( + plot_bc=True, + plot_bc_legend=True, + plot_bc_labels=True, + title="", + ) + + assert p is None + + @pytest.mark.parametrize( "bc_labels", # Added second part of the argument to avoid image cache name clashing. # See https://github.com/pyvista/pytest-pyvista/issues/93 @@ -255,12 +371,13 @@ def test_bc_plot_options( ["CSGZ", "Magnetic forces"], ], ) -def test_bc_plot_bc_labels(mapdl, bc_example, bc_labels): +def test_bc_plot_bc_labels(mapdl, boundary_conditions_example, bc_labels): p = mapdl.nplot( return_plotter=True, plot_bc=True, plot_bc_labels=True, bc_labels=bc_labels[0], + title="", ) assert isinstance(p, Plotter), bc_labels[1] p.show() # plotting for catching @@ -273,13 +390,14 @@ def test_bc_plot_bc_labels(mapdl, bc_example, bc_labels): ["UX", "error"], ], ) -def test_bc_plot_bc_labels_error(mapdl, bc_example, bc_labels): +def test_bc_plot_bc_labels_error(mapdl, boundary_conditions_example, bc_labels): with pytest.raises(ValueError): mapdl.nplot( return_plotter=True, plot_bc=True, plot_bc_labels=True, bc_labels=bc_labels, + title="", ) @@ -290,12 +408,13 @@ def test_bc_plot_bc_labels_error(mapdl, bc_example, bc_labels): ["NOdes", "Mixed case"], ], ) -def test_bc_plot_bc_target(mapdl, bc_example, bc_target): +def test_bc_plot_bc_target(mapdl, boundary_conditions_example, bc_target): p = mapdl.nplot( return_plotter=True, plot_bc=True, plot_bc_labels=True, bc_target=bc_target[0], + title="", ) assert isinstance(p, Plotter), bc_target[1] p.show() # plotting for catching @@ -310,13 +429,14 @@ def test_bc_plot_bc_target(mapdl, bc_example, bc_target): {"error": "Not accepting dicts"}, ], ) -def test_bc_plot_bc_target_error(mapdl, bc_example, bc_target): +def test_bc_plot_bc_target_error(mapdl, boundary_conditions_example, bc_target): with pytest.raises(ValueError): mapdl.nplot( return_plotter=True, plot_bc=True, plot_bc_labels=True, bc_target=bc_target, + title="", ) @@ -327,23 +447,31 @@ def test_bc_no_mapdl(mapdl): ) # mapdl should be an argument if plotting BC -def test_bc_only_one_node(mapdl, bc_example): +def test_bc_only_one_node(mapdl, boundary_conditions_example): mapdl.nsel("s", "node", "", 1) - mapdl.nplot(plot_bc=True) + mapdl.nplot( + plot_bc=True, + title="", + ) -def test_bc_glyph(mapdl, bc_example): +def test_bc_glyph(mapdl, boundary_conditions_example): mapdl.nplot(plot_bc=True, bc_glyph_size=19) with pytest.raises(ValueError): - mapdl.nplot(plot_bc=True, bc_glyph_size="big") + mapdl.nplot( + plot_bc=True, + bc_glyph_size="big", + title="", + ) -def test_bc_bc_labels(mapdl, bc_example, verify_image_cache): +def test_bc_bc_labels(mapdl, boundary_conditions_example, verify_image_cache): """Test values for 'bc_labels' keyword argument.""" verify_image_cache.skip = True # skipping image verification mapdl.nplot(plot_bc=True, bc_labels="UX") mapdl.nplot(plot_bc=True, bc_labels=["Ux", "uy", "VOLT"]) + with pytest.raises(ValueError): mapdl.nplot(plot_bc=True, bc_labels=["big"]) @@ -354,11 +482,15 @@ def test_bc_bc_labels(mapdl, bc_example, verify_image_cache): mapdl.nplot(plot_bc=True, bc_labels=["UX", {"not": "valid"}]) -def test_all_same_values(mapdl, bc_example): +def test_all_same_values(mapdl, boundary_conditions_example): """Test the BC glyph size when all the BC have same magnitude.""" mapdl.nsel("all") mapdl.f("all", "FX", 0) - mapdl.nplot(plot_bc=True, bc_labels="FX") + mapdl.nplot( + plot_bc=True, + bc_labels="FX", + title="", + ) @pytest.mark.parametrize( diff --git a/tests/test_pool.py b/tests/test_pool.py index 93370ed82a..25b8e100c7 100644 --- a/tests/test_pool.py +++ b/tests/test_pool.py @@ -27,7 +27,7 @@ import numpy as np import pytest -from conftest import ON_STUDENT, has_dependency +from conftest import ON_LOCAL, ON_STUDENT, START_INSTANCE, has_dependency if has_dependency("ansys-tools-path"): from ansys.tools.path import find_ansys @@ -37,16 +37,17 @@ else: EXEC_FILE = os.environ.get("PYMAPDL_MAPDL_EXEC") -if not EXEC_FILE or ON_STUDENT: - pytest.skip(allow_module_level=True) - -from ansys.mapdl.core import LocalMapdlPool, examples +from ansys.mapdl.core import MapdlPool, examples from ansys.mapdl.core.errors import VersionError from conftest import QUICK_LAUNCH_SWITCHES, requires # skip entire module unless HAS_GRPC pytestmark = requires("grpc") +# skipping if ON_STUDENT and ON_LOCAL because we cannot spawn that many instances. +if ON_STUDENT and ON_LOCAL: + pytest.skip(allow_module_level=True) + skip_if_ignore_pool = pytest.mark.skipif( os.environ.get("IGNORE_POOL", "").upper() == "TRUE", @@ -67,16 +68,30 @@ def pool(tmpdir_factory): run_path = str(tmpdir_factory.mktemp("ansys_pool")) - mapdl_pool = LocalMapdlPool( - 4, - license_server_check=False, - run_location=run_path, - port=50056, - start_timeout=30, - exec_file=EXEC_FILE, - additional_switches=QUICK_LAUNCH_SWITCHES, - nproc=NPROC, - ) + port = os.environ.get("PYMAPDL_PORT", 50056) + + if ON_LOCAL: + + mapdl_pool = MapdlPool( + 2, + license_server_check=False, + run_location=run_path, + port=port, + start_timeout=30, + exec_file=EXEC_FILE, + additional_switches=QUICK_LAUNCH_SWITCHES, + nproc=NPROC, + ) + else: + port2 = os.environ.get("PYMAPDL_PORT2", 50057) + + mapdl_pool = MapdlPool( + 2, + license_server_check=False, + start_instance=False, + port=[port, port2], + ) + yield mapdl_pool ########################################################################## @@ -102,7 +117,7 @@ def pool(tmpdir_factory): @skip_requires_194 def test_invalid_exec(): with pytest.raises(VersionError): - LocalMapdlPool( + MapdlPool( 4, nproc=NPROC, exec_file="/usr/ansys_inc/v194/ansys/bin/mapdl", @@ -111,7 +126,6 @@ def test_invalid_exec(): # @pytest.mark.xfail(strict=False, reason="Flaky test. See #2435") -@requires("local") def test_heal(pool): pool_sz = len(pool) pool_names = pool._names # copy pool names @@ -131,7 +145,6 @@ def test_heal(pool): pool._verify_unique_ports() -@requires("local") @skip_if_ignore_pool def test_simple_map(pool): pool_sz = len(pool) @@ -139,8 +152,8 @@ def test_simple_map(pool): assert len(pool) == pool_sz -@requires("local") @skip_if_ignore_pool +@requires("local") def test_map_timeout(pool): pool_sz = len(pool) @@ -168,7 +181,6 @@ def func(mapdl, tsleep): assert len(pool) == pool_sz -@requires("local") @skip_if_ignore_pool def test_simple(pool): pool_sz = len(pool) @@ -182,16 +194,14 @@ def func(mapdl): # fails intermittently -@requires("local") @skip_if_ignore_pool def test_batch(pool): - input_files = [examples.vmfiles["vm%d" % i] for i in range(1, 11)] + input_files = [examples.vmfiles["vm%d" % i] for i in range(1, len(pool) + 3)] outputs = pool.run_batch(input_files) assert len(outputs) == len(input_files) # fails intermittently -@requires("local") @skip_if_ignore_pool def test_map(pool): completed_indices = [] @@ -204,14 +214,16 @@ def func(mapdl, input_file, index): completed_indices.append(index) return mapdl.parameters.routine - inputs = [(examples.vmfiles["vm%d" % i], i) for i in range(1, 11)] + inputs = [(examples.vmfiles["vm%d" % i], i) for i in range(1, len(pool) + 1)] outputs = pool.map(func, inputs, wait=True) assert len(outputs) == len(inputs) -@requires("local") @skip_if_ignore_pool +@pytest.mark.skipif( + not START_INSTANCE, reason="This test requires the pool to be local" +) def test_abort(pool, tmpdir): pool_sz = len(pool) # initial pool size @@ -245,20 +257,18 @@ def test_abort(pool, tmpdir): assert path_deleted -@requires("local") @skip_if_ignore_pool def test_directory_names_default(pool): dirs_path_pool = os.listdir(pool._root_dir) - assert "Instance_0" in dirs_path_pool - assert "Instance_1" in dirs_path_pool - assert "Instance_2" in dirs_path_pool - assert "Instance_3" in dirs_path_pool + for i, _ in enumerate(pool._instances): + assert pool._names(i) in dirs_path_pool + assert f"Instance_{i}" in dirs_path_pool @requires("local") @skip_if_ignore_pool def test_directory_names_custom_string(tmpdir): - pool = LocalMapdlPool( + pool = MapdlPool( 2, exec_file=EXEC_FILE, run_location=tmpdir, @@ -286,7 +296,7 @@ def myfun(i): else: return "Other_instance" - pool = LocalMapdlPool( + pool = MapdlPool( 3, exec_file=EXEC_FILE, nproc=NPROC, @@ -305,7 +315,7 @@ def myfun(i): def test_num_instances(): with pytest.raises(ValueError, match="least 1 instance"): - pool = LocalMapdlPool( + pool = MapdlPool( 0, exec_file=EXEC_FILE, nproc=NPROC, @@ -313,10 +323,9 @@ def test_num_instances(): ) -@requires("local") @skip_if_ignore_pool def test_only_one_instance(): - pool = LocalMapdlPool( + pool = MapdlPool( 1, exec_file=EXEC_FILE, nproc=NPROC, diff --git a/tests/test_xpl.py b/tests/test_xpl.py index 6c98705f63..c6f26dbad5 100644 --- a/tests/test_xpl.py +++ b/tests/test_xpl.py @@ -80,6 +80,11 @@ def test_read_asarray(xpl): def test_save(xpl): + if xpl._mapdl.version == 24.2: + pytest.xfail( + "There is a bug (977113) on v242 which makes saving using XPL to fail." + ) + xpl.save() with pytest.raises(MapdlCommandIgnoredError): xpl.list()