FV Terminal 3.12.02: queue for automatically launching calculations

 For the first time in our blog - the whole article is devoted to the FVTerminal module! If you want to speed up and automate the start of your simulations, then you just need to get acquainted with its capabilities.

FVTerminal allows you to perform certain operations while bypassing FVPPP, and can also do other cool things:

  • start and stop calculation (on local and remote computers)
  • download the client part of the project form the server part data
  • delete projects permanently 
  • connect to the Solver via the Viewer
  • and most interesting of all - queue projects 

If Chuck Norris used FlowVision, he would definitely be able to set up the project directly in FVTerminal and run it for calculation. We are a long way from Chuck: the Terminal can't be used to set up a project, but we will share some lifehacks.

How to start 10 projects on Friday evening and have results ready to process on Monday morning? It's possible - all the magic is in the queue system. One by one, projects will be uploaded, calculated, stopped, saved, unloaded... whatever you want!

It's become even easier to launch a calculation cycle with the arrival of the command file creation window directly within the Terminal in FlowVision 3.12.02. It was this new feature that prompted me to write this article and share how easy it is to create a command file.

WHAT IS THE BENEFIT OF A QUEUE SYSTEM? 

The queue system is a technology for automatization of simulations. It is not a secret that the efficiency of simultaneously launching 10 projects on one computer is close to zero. But if you put 10 projects in the queue, then it's a whole different matter. Use the queue system to save time during:

  • convergence studies
  • parametric studies of geometric models
  • investigation of device operation in different modes
  • calculation of even two projects. Don't spare your computer! Let it do the work, while you rest.

HOW does THE QUEUE SYSTEM WORK IN FLOWVISION? 

Let's demonstrate with an example.

To add a project to the queue in FVTerminal, just right-click on it and select "Place project in queue". Alternatively, to queue a project you can also use the keyboard shortcut Ctrl + Q.

But first, check that the project is completely ready for calculation: the stop criteria are set, the server part of the project exists in the server directory, and a command file has been created.

1en

 After that, a window will appear in which the following settings are determined:

  • solver settings: how many processors * cores you want to use to calculate the selected project.
  • calculation settings: "start from the beginning or continue from last iteration?", "when should the calculation be stopped?" - all this information is written in the command file as a set of commands. By default, the command file is named "command.txt" and is located in the server part of the project. However, you may use a command file with an arbitrary name and storage location. To tell the Solver which non-default command file to use, specify the path to the file using the browse line.

2

When you press the "Ok" button, the project will be issued a ticket and placed in the queue, where it will await the bright future of being calculated. After the simulation concludes, the calculating solver is killed (The main thing is to not forget to include this command!), and simulation of the next project in the queue begins. 


command file gENERATION AND STANDARD LAUNCH OF simulationS IN THE QUEUE SYSTEM

The command file is a list of tasks for the Solver. All commands are processed sequentially, in the order specified by the user.

Creating a command file is an essential part of adding a project to a queue: without it, the solver does not know what to do with the project. Besides being used in the queue system, the command file has other interesting applications:

let's create a command file together

Previously, you had to create the command file manually, searching the documentation for command names and placing command.txt in the project folder, but now everything has become much easier.
So, let's create a command file. To do this, we'll open FvTerminal and choose the project we want to work with. Right-clicking opens a context menu that displays a set of commands. Among these is "Create command file".

3

When the command is executed, a new "Command file creation" window appears.

4

In this window, you create the sequence of commands that will be executed for this project. A list of possible commands is presented to the right of the input window, and a detailed description of each can be found in the documentation.

As a result, the command.txt file will be created in the server part of the project.

using a template

If a command file (command.txt) already exists in the client project folder, it will automatically be opened in the “Create command file” window where it can be edited.

Also FvTerminal gives you the ability to create your own template command file. This is so that, for example, you wouldn't have to type the same commands ten thousand times when placing projects in a queue. Memorizing a set of commands in the input window and assigning it the status of a template occurs when you select "Save as template" Then, whenever you select "Use Template", the command file will be generated on the basis of this saved template.

An example command file 

A template command file for placing a project in a queue contains the following set of commands:

SS_PROJECTLOAD<./name.fvproj><><><> // upload the project to the Solver
SS_SOLVESTART<0> // start the simulation from scratch
SS_DO_NOT_DISTURB // do not process other requests until the simulation ends - the project will stop only when the stop criterion is triggered
SS_PRJDATASAVE // save the simulation results
SS_PROJECTUNLOAD // unload the project from the Solver
SS_SHUTDOWNSOLVER // stop Solver operation

Two things that should be noted if you create a command file in Terminal:

  • When selecting the SS_PROJECTLOAD command, FvTerminal will automatically put the project name in the command name.
  • When the SS_SOLVESTART and SS_SOLVESTART_EX commands are used, FvTerminal will automatically offer a choice of launch mode: to continue calculation from the last time step or to calculate from scratch, with or without a connector. Therefore, do not be worried when you see a familiar window in an unfamiliar environment.

6

QUEUE SYSTEM OPERATION AFTER LAUNCHING A simulation through A COMMAND FILE

When the command file is ready, you can execute the "Place in Queue" command.

By the way, you can create a command file even at this stage - you will see a special button in the window.

The first projects in the queue will start to be calculated with the status "(A) Calc". This means that the solver is working in an autonomous mode and neither PPP, nor FvTerminal can terminate the work of the solver from outside. The solver will continue working until the solution stops in FlowVision. You can connect to a running solver only via FvViewer. You can terminate the work of such a solver through the Task Manager (process FvSolver64.exe) or by closing the solver console window. The rest of the projects will have the status "In the queue".


some advice on working with the queue system

use stop criteria 

Calculation on a queued solver can last indefinitely. For example, if the project does not have any stop criteria. Before launching the project for calculation, make sure that it has stop criteria that will allow the solver to finish and shut down to free the queue.

The following stop conditions and commands are available for stopping a project:

  • Stop condition based on a physical variable
  • Stop condition based on time step
  • Stop condition based on current time
  • SS_SOLVESTART_EX <> <> <> command, which stops the project at the required moment in time or at the desired iteration without setting stopping conditions in the PPP.
CHECK LAUNCH SETTINGS BEFORE ADDING a project TO the QUEUE

In the current version of FlowVision the queue displays a strict project launch sequence. There is no way to move projects up or down in the queue. Also you are unable to remove a project from the queue. Therefore, it is best to double-check all launch settings.

HOW TO NOT make a MISTAKE setting THE CORE*PROCESSOR NUMBER when ADDing the project TO a QUEUE?

If you do not plan on giving the FlowVision queue system all of your computational resources (for example, if the calculation is carried out in parallel in another program), then in FvConfigurator you can limit the maximum number of available threads that will be allocated for the FlowVision solver.

By default, the Solver Agent (SA) automatically allows FlowVision to launch solvers that use all available threads. For example, your computer has 1 processor with 8 cores. Then you can run one 1x8 solver, or two 1x4 solvers at the same time, and so on: the main thing is to use all 8 cores in total. When queuing a project, the Terminal will not allow you to set more than 8 cores for calculation. But if you decide to leave a couple of cores free from FlowVision calculations and limit the maximum number of available threads to 6 in the Configurator, then two 1x4 solvers will not launch at the same time, since the sum of the threads used would be more than 6.

You can set the upper limit for the number of threads available to solvers in the queue in the Configurator: FvConfigurator > Configuration/Protocols tab > Configuration files > Solver-Agent.

6en


conclusion

  1. A new option has appeared in FlowVision 3.12.02: the "Create command file" window has been added to the Terminal interface. This is an integral part of adding a project to the queue. Read more about this new functionality above, in this article, or in the documentation.

  2. The queue is used to automate launching projects for calculation. Simultaneous calculation of several projects has an efficiency close to zero, but the queue allows you to remember launch settings and start calculations automatically without the involvement of an engineer. Thus, if you specify the launch settings in the evening, you will most likely be able to process the results the next morning. Let your computer perform the calculations while you relax - use the project launch queue.

  3. Remember to check the following:
    • the presence of stopping conditions, so that your project doesn't end up being calculated for eternity
    • launch settings - especially the number of processors * cores that you plan to use for the project
About the author
Elena Ovsyannikova
Author: Elena Ovsyannikova
Technical support engineer
Bauman Moscow State Technical University (BMSTU). Expert in FSI, CFD and study of strength of materials