Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions examples/mapdl_tyre_performance/project_setup.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
# ----------------------------------------------------------
# Copyright (C) 2019 by
# ANSYS Switzerland GmbH
# www.ansys.com
#
# Author(s): F.Negri
# ----------------------------------------------------------
"""
Example to setup a nonlinear tyre analysis job in REP.

Author(s): F.Negri
"""

import argparse
import logging
import os
import random
import sys

from ansys.rep.client import REPError
from ansys.rep.client import __external_version__ as ansys_version
from ansys.rep.client.jms import (
Client,
File,
FitnessDefinition,
FloatParameterDefinition,
Job,
JobDefinition,
ParameterMapping,
Project,
ResourceRequirements,
Software,
SuccessCriteria,
TaskDefinition,
)

log = logging.getLogger(__name__)


def main(client, name, num_jobs):
"""Create a DCS project consisting of the ANSYS APDL Tire-Performance Simulation
example included in the technology demonstration guide (td-57).
"""
Create project with Ansys MAPDL tire simulation.

ANSYS APDL Tire-Performance Simulation example as included
in the technology demonstration guide (td-57).
"""
log.debug("=== Project")
proj = Project(name=name, display_name="MAPDL Tyre Performance", priority=1, active=True)
proj = client.create_project(proj, replace=True)
Expand Down
36 changes: 15 additions & 21 deletions examples/python_multi_process_step/project_setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
# ----------------------------------------------------------
# Copyright (C) 2021 by
# ANSYS Switzerland GmbH
# www.ansys.com
#
# Author(s): R.Walker
# ----------------------------------------------------------
"""
Project setup script for multi process step and task file replacement testing.

Author(s): R.Walker

Run *python eval.py --help* for command line arguments.

The project id is generated as
The project id is generated as
"py_{NUM_PROCESS_STEPS}_ps" and the `_img` is appended if result image is written.

Per default the project is inactive. You can activate the project with the `-a` flag
Expand All @@ -20,26 +15,22 @@
```
python project_setup.py -n 100 -c 10 --no-images
```
Create 100 design points
and change the first 10 design points
Create 100 design points
and change the first 10 design points
and do not write an result image.



"""
import argparse
import logging
import os
import random
import sys

from task_files import update_task_files

from ansys.rep.client import REPError
from ansys.rep.client.jms import (
Client,
File,
FitnessDefinition,
IntParameterDefinition,
Job,
JobDefinition,
Expand All @@ -66,13 +57,16 @@ def main(
inactive,
sequential,
):
"""
Python project implementing multiple process steps and optional image generation
"""
"""Python project implementing multiple process steps and optional image generation."""
log.debug("=== Project")
name = (
f"py_{num_task_definitions}ps{'_img' if images else ''}{'_seq' if sequential else '_par'}"
)
display_name = f"Python - {num_task_definitions} Task Defs {' - Img' if images else ''}"
display_name += f"{' - Sequential' if sequential else ' - Parallel'}"
proj = Project(
name=f"py_{num_task_definitions}ps{'_img' if images else ''}{'_seq' if sequential else '_para'}",
display_name=f"Python - {num_task_definitions} Task Defs {' - Img' if images else ''}{' - Sequential' if sequential else ' - Parallel'}",
name=name,
display_name=display_name,
priority=1,
active=not inactive,
)
Expand Down Expand Up @@ -293,13 +287,13 @@ def main(
"--images",
action="store_true",
default=False,
help="Enable if you want images to be generated. Needs PIL installed ( `pip install pillow` ) ",
help="Enable if you want images generated. Needs PIL installed ( `pip install pillow` ) ",
)
parser.add_argument(
"--sequential",
action="store_true",
default=False,
help="Whether to evaluate all process steps of a design point sequentially or in parallel (same execution level)",
help="Whether to evaluate all tasks of same exec level per job sequentially or in parallel",
)

args = parser.parse_args()
Expand Down