Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
GeoStudio | PLAXIS
  • Product Communities
GeoStudio | PLAXIS
GeoStudio | PLAXIS Wiki Closing PLAXIS after your calculation is finished
    • Sign In
    • -Geotechnical Analysis Wiki
      • +GeoStudio
      • -PLAXIS
        • +Software and License - PLAXIS
        • +Documentation - PLAXIS
        • +API / Python scripting - PLAXIS
        • +Known issues - PLAXIS
        • +Models - PLAXIS
        • -Tips and Tricks
          • 3D Extrusion along a curved path
          • 3D Output: show results for shadings or contour lines
          • 64 bit User Defined Soil model
          • After a consolidation analysis I have excess pore pressures in "drained" material sets. Why?
          • An error occurred in the application – What to do
          • Application of commands: echo
          • Application of commands: Groupfiltered and Apply
          • Application of commands: Referring to objects through their index
          • Calculation Kernel Convergence log
          • Can I import a geometry in PLAXIS 2D?
          • Can I reuse existing PLAXIS 3D geometrical objects in a new project?
          • Change temporary folder for intermediate calculation data files
          • Closing PLAXIS after your calculation is finished
          • CodeMeter network error during calculation (IPv4/v6 conflict)
          • Codemeter Network Installation
          • Codemeter USB Stick behaviour
          • Command line reference
          • Compliant base and free field boundaries: check on input signal
          • Composite liner approach in PLAXIS 2D
          • Connect a node-to-node anchor with an embedded beam row halfway
          • Considerations for modelling a thick slab as a plate
          • Consolidation: Minimum Pore Pressures and Degree of Consolidation analysis may give spurious displacements of boundary nodes
          • Conversion from 2D Version 8/9
          • Conversion of PLAXIS 2D files
          • Copy/Array command in Plaxis 2D
          • Create centerline for Structural Forces in Volumes
          • Create rock bolts accurately in PLAXIS 3D
          • Creating axial force curve for Fixed End anchors
          • Deactivated loads are still visible in PLAXIS Output
          • Definition of a bending moment as load
          • Definition of Hoek-Brown model parameters in Plaxis
          • Drained Settlement Vs. Consolidation: Differences at Failure in Output
          • Drift correction for dynamic input signal from file
          • During a calculation some plastic points disappear. How is that possible?
          • Dynamic Load with Perpendicular Distribution
          • Effect of suction on soil strength, compressibility and slope stability
          • Encrypted scripting server vulnerable to replay attacks
          • End bearing of plates
          • Energy saving while running multiple calculations
          • Error when generating 3D mesh
          • Export and format plots from PLAXIS Output
          • Export or reuse geometry for New Analysis
          • Extended command syntax for mesh generation
          • Fixed and Compliant base: what input motion is required?
          • Fixities and deformation boundary conditions
          • Force envelope results explained
          • Fundamentals of pseudo-static analysis in PLAXIS
          • General modeling guidelines - recommendations
          • Graphics card issues
          • Groundwater flow analysis in PLAXIS – Brief overview
          • How do I import a geometry in PLAXIS 3D?
          • How does Plaxis deal with water pressures during dynamic calculations?
          • How does Reset displacements to zero work?
          • How does the option volumetric strain work?
          • How to activate a dynamic load
          • How to change the PLAXIS model width
          • How to check undrained shear strength using Undrained A?
          • How to convert PLAXIS V21 material database to the V22 format
          • How to define and edit a material via the command line
          • How to get a load - displacement curve using SumMstage
          • How to prescribe a dynamic displacement
          • How to run a Limit Equilibrium Method analysis from PLAXIS 2D
          • How to select more than 10 nodes to be used for a curve
          • How to setup the number of steps stored in PLAXIS Input
          • How to setup tied degrees of freedom
          • How to use command log files
          • How to validate a material via the GUI and command line
          • Hydraulic conductivity input in PLAXIS using van Genuchten functional forms in a groundwater flow analysis
          • I use PLAXIS and it says I do not have the proper entitlements
          • Improving speed of mesh generation in combination with stage generation
          • In Plaxis Curves it is possible to plot Force Fx, Fy and Fz. What are these parameters?
          • Initial degree of saturation for soil activated during staged construction
          • InputSettings object in Output
          • Inspect intermediate step results in PLAXIS Output
          • Install latest 2D version and 2D AE for converting older files
          • Is it possible to apply a distributed load on tunnel lining in PLAXIS 2D?
          • Is PLAXIS 3D 64-bit?
          • Is PLAXIS 3D enabled for multicore?
          • Iterative settings: desired minimum and maximum
          • Iterative settings: Influence of Arc length control
          • Iterative settings: Max unloading steps (arc length control)
          • Key not bound to machine
          • Language reset in PLAXIS 2D and 3D
          • Launch PLAXIS 2D calculations via DOS commands
          • Load activation in time
          • Local axis and its colour indication
          • Macros using the commands runner
          • Material datasets for plates: sheet pile wall in bending
          • Materials overview in the Model explorer
          • Memory usage in dynamic calculations
          • Mesh alignment in flow problems
          • Mesh generation might not work under Windows 7 due to security settings
          • Modelling a tapered pile
          • Modelling Rock mass using discrete discontinuities vs Jointed Rock
          • Modelling soil-structure interaction: interfaces
          • Modelling technique: Vacuum consolidation
          • Modifying boundary conditions
          • Multicore CPU and 32/64-bit
          • NATM Tunneling - Beta Method: Incomplete Staged construction method vs. Deconfinement method
          • Node-to-Node anchors as an alternative for Fixed-End anchors
          • Non-consecutive order of step numbers in Plaxis
          • Obtain Object names easily to use in commands
          • Obtaining tabulated data for materials in PLAXIS Input
          • Obtaining tabulated data from PLAXIS Input
          • Obtaining time-dependent flow results at specific timestamps in a given time interval in Flow only calculations
          • On different failure criteria for soils
          • On the initialisation of the temperatures of solid elements
          • On the use of dynamic boundary conditions
          • Opening old PLAXIS project gives a popup window. What should I do?
          • Output of flow results through interfaces
          • Output project compatibility
          • Permeability in interfaces
          • Permeability in interfaces: Practical situations
          • Pile modelling in a 2D plane strain model
          • PLAXIS 2D Command compatibility notes
          • PLAXIS 3D 2013 and older PLAXIS files
          • PLAXIS 3D 2016: Fully parametric geometry
          • PLAXIS 3D Command compatibility notes
          • PLAXIS Legacy version and supported CodeMeter drivers
          • PLAXIS Output Phase/Step object compatibility
          • PLAXIS Silent Installation
          • PLAXIS Soil model numbers in command line
          • Plaxis uses SMC files for earthquakes, but what kind of format is this?
          • Points of interest for pile modelling in a 2D plane strain model
          • Problems related to non-associated plasticity
          • Program responds that drivers are out of date, but I have a newer version installed
          • Pseudo static acceleration
          • Re-use materials from other projects
          • Reduction of stiffness does not lead to a change in displacements
          • Regenerate staged construction
          • Run multiple calculations easily
          • Safety analysis and displacements
          • Safety analysis and undrained behaviour
          • Safety analysis and Updated Mesh
          • Safety calculation with a Target Value
          • Saving PLAXIS files for an older version
          • Select points for curves prior to calculation directly in Input
          • Selecting points for curves
          • Set multiple phases to be calculated
          • Showing a list of embedded beams by length
          • Small overlaps curves message in SoilTest optimisation
          • Smart selection of line elements in PLAXIS 2D Input
          • Stiffness units for structural elements in an axisymmetric model
          • Stress relaxation due to creep in concrete structures
          • Stresses in non-porous materials
          • Structural results in tables and curve plots
          • Swept meshing in PLAXIS 3D
          • Tensile behaviour in the Hoek-Brown model
          • Tension cut-off in interfaces for User Defined Soil Models
          • Time step used in dynamic calculation
          • Trim and extend a line in PLAXIS 2D
          • Tunnels in PLAXIS 3D: Extrusions and cutting planes
          • Unable to select points for curves
          • Unable to select structures or nodes
          • Use of wells in PLAXIS 3D
          • Using an accelerogram for Dynamics
          • Using partial geometry for interesting result images in PLAXIS 3D
          • Using PLAXIS Remote scripting with the Python wrapper
          • Waterlevel inspection and editing in PLAXIS 2D
          • Westergaard's added mass for hydrodynamic pressures: a simple case
          • +Working from home with PLAXIS
        • +Publications
        • +Videos - PLAXIS
      • +PLAXIS Monopile Designer
      • +PLAXIS LE
      • +SOILVISION
      • +Geotechnical SELECT Entitlements [GSE]
      • +Subscription Entitlement Service

     
     Questions about this article, topic, or product? Click here. 

    Closing PLAXIS after your calculation is finished

    Application PLAXIS 2D
    PLAXIS 3D
    Version PLAXIS 2D CONNECT Edition V20
    PLAXIS 3D CONNECT Edition V20
    Date created 11 November 2020
    Date modified 11 November 2020

    After a PLAXIS calculation is finished, the PLAXIS program will stay open and active. PLAXIS will also not automatically save the calculation results: this save action is something the user must explicitly do to confirm changes in order to avoid accidental loss of work or save the file under a new name.

    When running your calculation overnight, or over the weekend, it would be nice if the calculation was automatically saved and the PLAXIS program closed. This has benefits, as it can release software license usage, or you might even want to shut down the computer to save energy.

    For this purpose, you can make use of the PLAXIS Calculation manager, where you can queue up PLAXIS 2D and PLAXIS 3D calculations, or use manual control to run calculations, save them and move to the next one using the command line, or Python scripting.

    Calculation manager

    The PLAXIS Calculation manager allows you to queue several PLAXIS 2D and PLAXIS 3D models to be calculated.

    For full details and instruction video, please see the page: Calculation manager for PLAXIS 2D and PLAXIS 3D.

    Manual controlling calculation and saving

    Sometimes you want manual control or additional functionality. There are two commands in PLAXIS 2D and PLAXIS 3D that can help with closing PLAXIS:

    • __kill to immediately shut down the PLAXIS application
    • __gogreen to shut down the application and the computer

    * note the double underscore at the start of both commands. These are added on purpose to prevent accidental usage.

    In order to make use of these commands automatically after a calculation is finished, you will need to run all the commands, including the calculate command via the Commands Runner, via a macro, or you can take advantage of the Remote Scripting facility to control PLAXIS.

    Note: these options only control the PLAXIS Input application. If you have other PLAXIS programs running (e.g. PLAXIS, SoilTest, PLAXIS Output, Sensitivity Analysis & Parameter variation), these will not be closed via the __kill command, and consequently, this will keep your license in active usage.

    Calculate and close PLAXIS

    In order to tell PLAXIS to run the calculation, store results and shut down, we will need three commands:

    calculate  # this will calculate all phases marked for calculation 
    save       # explicitly save the newly calculated data 
    __kill     # this will shut down PLAXIS 

    We can write these commands in the Commands Runner (Expert menu) and execute them in our project:

    When using this solution more often, creating a macro will make this efficient. You can create a commands macro easily via the Expert > Macro menu item. Here you can specify a name for the macro and the commands it will use:

    After storing, it can be accessed easily via the Macro menu item:

    Select Macro from Expert menu

    This approach can also be used in combination with Batch files, see Practical use of the commands runner: Using a batch file to run commands.

    Shut down the computer when PLAXIS is finished

    PLAXIS offers the option to also close and shutdown windows using the __gogreen command.

    With the __gogreen command, you have the options to either hibernate the computer or completely shut down your computer.

    Do not forget to add the SAVE command before calling the shutdown command, otherwise, all calculation results will be lost!

    For more details and options please see the Commands Reference, available via the Help menu in the PLAXIS Input program or this related wiki page: Energy saving while running multiple calculations.

    Note that shutting down the computer with this command will force the computer to shut down. If you have unsaved data in other applications, this could be lost, so make sure all data is safely stored.

    Remote scripting solution 1: standalone script

    When using Python scripting, a possible strategy running it as a standalone script consists of starting PLAXIS as a subprocess and terminate it after having performed all intended operations.

    A simple standalone Python script example illustrating the required steps for opening a file, calculating the phases, saving the file and closing PLAXIS is provided below:

    # import subprocess module
    import subprocess
    
    # start PLAXIS as a subprocess
    plxpath = r"C:\Program Files\Bentley\Geotechnical\PLAXIS 2D CONNECT Edition V20\Plaxis2DXInput.exe"
    plx = subprocess.Popen([plxpath, "--AppServerPort=XXXXX", "--Password=yourpassword"])
    
    # Notes:
    # (1) the path locating PLAXIS executable (plxpath) may need to be modified (e.g. when using PLAXIS 3D)
    # (2) XXXXX refers to the active server port and yourpassword to remote scripting server password
    # (3) yourpassword should be written, in this case, without quotes
    
    # import PLAXIS scripting module and connect to PLAXIS application
    from plxscripting.easy import *
    s_i, g_i = new_server('localhost', XXXXX, password='yourpassword')
    
    # open a PLAXIS project
    plaxisfile = r'C:\projectpath\projectname.p2dx'
    s_i.open(plaxisfile)
    
    # perform all intended operations
    # (…)
    
    # calculate the project
    g_i.calculate()
    
    # save the project
    g_i.save(plaxisfile)
    
    # terminate PLAXIS application
    plx.terminate()
    

    Remote scripting solution 2: script used in PLAXIS Input

    Another solution is to use a Python script to run an analysis of the current open PLAXIS file while working in PLAXIS Input.

    In this example, we run the file, take the same name and append the _[calculated] to the filename to make a distinction what the calculated file is. Of course, other options could be added to change the filename, like adding a timestamp or other information, or you can even change the save location to a shared location.

    # get current file name if available
    currentfilename = g_i.Project.Filename.value
    while currentfilename == '':
        # empty filename
        response = input("\nYou did not save the PLAXIS file yet.\nPlease manually save it in PLAXIS and hit [Enter] to continue.")
        currentfilename = g_i.Project.Filename.value
    
    # make sure we only calculate when we have a filename
    if currentfilename != '':
        # get the current name and determine new save name
        # here we add _calculated if it is not added yet
        postfix = "_[calculated]"
        folder, filename = os.path.split(currentfilename)
        savename, ext = os.path.splitext(filename)
        if postfix not in savename:
            savename = savename + postfix
        newfilename = os.path.join(folder, savename + ext)
    
        # ensure we are in staged construction / calculation mode
        g_i.gotostages()
    
        # running the calculation
        print("Starting calculation")
        print("When finished, it will be saved as:")
        print(newfilename)
        force_all_phases  = True # Boolean to force all phases to be calculated
        g_i.calculate(force_all_phases)
        print("\nCalculation done")
    
        # optional: run post-processing
        # ...
    
        # save the file
        g_i.save(newfilename)
        print("Saved as: {}".format(newfilename))
    
        # optional: close PLAXIS
        g_i.kill()
    

    In order to use this script from within PLAXIS Input:

    • copy the Python script to a new file and save it as a Python script file (*.py)
    • store the *.py file in the pytools\input folder located in the PLAXIS installation folder. Default folders are:
      • PLAXIS 2D: C:\Program Files\Bentley\Geotechnical\PLAXIS 2D CONNECT Edition V20\pytools\input
      • PLAXIS 3D: C:\Program Files\Bentley\Geotechnical\PLAXIS 3D CONNECT Edition V20\pytools\input
    • In the Expert menu, go to Python > Run script > Tools. Here you should see the name of Python file. When selecting it, it will execute the script to calculate and save your calculated PLAXIS model.

    When you do not have access rights to add the script in the mentioned folder, alternatively, you can choose to use Expert menu > Python > Run script > Open... to manually open and run the file.

    Tips

    The calculate command

    The calculate command can take additional parameters to control what you want to calculate.

    • If you do not give any parameters PLAXIS will calculate all phases marked for calculation. If you have not marked any phases for calculation, no phases will be calculated:
      • command line: _calculate
      • Python: g_i.calculate()
    • If you only want to calculate a specific phase or phases, you can do so by adding the phase names as parameters for the command. For instance, to calculate only Phase_2 and Phase_9, you can do the following:
      • command line: _calculate Phase_2 Phase_9
      • Python: g_i.calculate(g_i.Phase_2, g_i.Phase_9)
    • You can force to calculate all phases by adding the True argument:
      • command line: _calculate true
      • Python: g_i.calculate(True)

    Saving under a different name

    When running automated commands, using macros or Python scripts that will just save the current PLAXIS model (so only the save command without a location), it will use the current file name to save it. And if you did not save the file under a specific name after starting a new PLAXIS project, the save command will not work and responds with First save command must specify a location.
    For those cases, make sure to manually save the file using the desired name and location.

    Note: in order to release all PLAXIS software usage for the CONNECTION Client, all PLAXIS instances should be closed. This includes PLAXIS Input, PLAXIS Output and PLAXIS SoilTest. The above-mentioned examples only close PLAXIS Input via the Commands runner or Python scripting. In order to free your PLAXIS software usage, make sure to close all other PLAXIS applications.

    See also

    Calculation manager for PLAXIS 2D and PLAXIS 3D    [Videos]


    Run multiple calculations easily    [Tips and Tricks]


    Practical use of the commands runner: using a batch file to run commands    [Tips and Tricks]


    Macros using the commands runner    [Tips and Tricks]


    Energy saving while running multiple calculations    [Tips and Tricks]

    • calculation manager
    • PLAXIS 3D
    • release license
    • License
    • commands runner
    • PLAXIS
    • Usage
    • Macro
    • PLAXIS 2D
    • Share
    • History
    • More
    • Cancel
    • Micha van der Sloot Created by Bentley Colleague Micha van der Sloot
    • When: Wed, Nov 11 2020 8:36 AM
    • Revisions: 1
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies