Skip to content

Commit

Permalink
check IP address for all examples and add code to delete remote insta…
Browse files Browse the repository at this point in the history
…nce in quit function
  • Loading branch information
zhangzhanqun committed Feb 23, 2024
1 parent 7a0cd5b commit 45e0b00
Show file tree
Hide file tree
Showing 36 changed files with 5,559 additions and 35 deletions.
3 changes: 2 additions & 1 deletion examples/Airbag/airbag_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
#
from ansys.dyna.core.pre.dynamaterial import MatRigid, MatFabric
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/airbag/airbag.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

###############################################################################
Expand Down
3 changes: 2 additions & 1 deletion examples/EM/em_resistive_heating.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
from ansys.dyna.core.pre.dynamaterial import MatElastic,MatThermalIsotropic,EMMATTYPE,EMEOSTabulated1
from em_set_data import *
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/em/em_resistive_heating.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/EM/em_resistive_heating_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
)
from ansys.dyna.core.pre.dynamaterial import MatRigid,MatThermalIsotropic,EMMATTYPE,EMEOSTabulated1
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/em/resistive_heating_2d.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/EM/em_resistive_heating_2d_isopots.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
from ansys.dyna.core.pre.dynamaterial import MatRigid,MatThermalIsotropic,EMMATTYPE,EMEOSTabulated1
from em_set_data import rogoseg
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/em/resistive_heating_2d_isopots.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/EM/em_resistive_heating_2d_multi_isopots.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
from ansys.dyna.core.pre.dynamaterial import MatRigid,MatThermalIsotropic,EMMATTYPE
from em_set_data import rogoseg
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/em/resistive_heating_2d_isopots.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/EM/em_rlc_define_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
)
from ansys.dyna.core.pre.dynamaterial import MatRigid,EMMATTYPE
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/em/rlc_isopotential.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/EM/em_rlc_isopotential.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
from ansys.dyna.core.pre.dynamaterial import MatRigid,EMMATTYPE
from em_set_data import rlc_rogoseg
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/em/rlc_isopotential.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/Explicit/ball_plate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
MatPiecewiseLinearPlasticity,
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/explicit/ball_plate.png'

###############################################################################
Expand All @@ -52,7 +53,7 @@
# (``"localhost"`` and ``"50051"`` respectively).
#
hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]
solution = launch_dynapre(ip = hostname)

Expand Down
3 changes: 2 additions & 1 deletion examples/Explicit/belted_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
)
from belted_dummy_data import *
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/explicit/belted_dummy.png'

###############################################################################
Expand All @@ -59,7 +60,7 @@
# (``"localhost"`` and ``"50051"`` respectively).
#
hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]
dummy_solution = launch_dynapre(ip = hostname)

Expand Down
5,466 changes: 5,466 additions & 0 deletions examples/Explicit/output/ball_plate.k

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/ICFD/icfd_cylinderflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
MeshedVolume,
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/cylinderflow.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

icfd_solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_dam_break.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
Compressible
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/dam_break.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_dem_coupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
from ansys.dyna.core.pre.dynadem import DEMAnalysis
from ansys.dyna.core.pre.dynamaterial import MatRigidDiscrete
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/dem_coupling.png'


hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_driven_cavity.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
ICFDDOF
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/driven_cavity.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_free_convection_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@

)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/free_convection_flow.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_imposed_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
Curve
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/imposed_move.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_internal_3d_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
ICFD_SurfRemeshMethod
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/internal_3d_flow.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_mesh_adaptivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
ICFDAnalysis
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/mesh_adaptivity.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_mesh_morphing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
ICFDAnalysis
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/mesh_morphing.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_mesh_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
ICFDAnalysis
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/mesh_size.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_plate_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
ICFDAnalysis
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/plate_flow.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_sloshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
Compressible
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/sloshing.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_strong_fsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
)
from ansys.dyna.core.pre.dynamaterial import MatRigid
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/strong_fsi.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_thermal_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
ICFDAnalysis
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/thermal_flow.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ICFD/icfd_weak_fsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
)
from ansys.dyna.core.pre.dynamaterial import MatRigid
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/icfd/weak_fsi.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

solution = launch_dynapre(ip = hostname)
Expand Down
3 changes: 2 additions & 1 deletion examples/ISPH/rigidtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
GravityOption,
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/isph/rigidtest.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]
isphsolution = launch_dynapre(ip = hostname)
fns = []
Expand Down
3 changes: 2 additions & 1 deletion examples/Implicit/camry_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
)
from camry_rc_data import *
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip

###############################################################################
# Start the ``pre`` service
Expand All @@ -56,7 +57,7 @@
# (``"localhost"`` and ``"50051"`` respectively).
#
hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]
camry_solution = launch_dynapre(ip = hostname)

Expand Down
3 changes: 2 additions & 1 deletion examples/NVH/frf_plate_damping.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ResponseType,
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/nvh/frf_plate_damping.png'
###############################################################################
# Start the ``pre`` service
Expand All @@ -46,7 +47,7 @@
# (``"localhost"`` and ``"50051"`` respectively).
#
hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]
solution = launch_dynapre(ip = hostname)
###############################################################################
Expand Down
3 changes: 2 additions & 1 deletion examples/NVH/nvh_frf_solid.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
ExcitationType
)
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/nvh/frf_column_hole.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]
solution = launch_dynapre(ip = hostname)
fns = []
Expand Down
3 changes: 2 additions & 1 deletion examples/SALE/sale_efp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
)
from ansys.dyna.core.pre import dynamaterial as matDB
from ansys.dyna.core.pre import examples
from ansys.dyna.core.pre.misc import check_valid_ip
# sphinx_gallery_thumbnail_path = '_static/pre/sale/efpcase.png'

hostname = "localhost"
if len(sys.argv) > 1:
if len(sys.argv) > 1 and check_valid_ip(sys.argv[1]):
hostname = sys.argv[1]

efp_solution = launch_dynapre(ip = hostname)
Expand Down
Loading

0 comments on commit 45e0b00

Please sign in to comment.