[S0022] Submit batch execution job of specified studies within an analysis group

 

An analysis group is used to group studies together in situations such as coupled analyses or when multiple studies have a single analysis objective.
In analysis groups that type is sequential calculation, it is possible to run only some of the studies in the group to, for example, check the validity of the analysis settings.
This script performs a batch execution of the active case for some of the studies included in the analysis group.

Preconditions

  • An analysis group that can be run and the type is sequential calculation have been created.
    This script runs on the active analysis group in the project tree.
  • The titles of the studies to be run are known.
    This script specifies three studies by title.

Script Function

  • Create a job object for batch execution of the analysis group and set the execution parameters.
    Specify three studies to run: “NoLoad,” “Load,” and “Demagnetization” by their titles.
    Other parameters are set not performing conflict check, not ignoring geometry errors when running analysis, and initial state to submit queue.
  • Add the job and wait until it is completed.
  • Once the job is completed, check for new results and load the results.
    If the calculation is completed successfully, the results of the specified studies will be loaded.
# Copyright (c) 2026 JSOL CORPORATION
#
# This script is released under the MIT License.
# See the full license text at:
# https://www.jmag-international.com/scriptlibrary/jmag_script_library_mit/

def submitActiveCaseToQueue(anaGroup, tgtStudyNmArray):
    """Batch execution of specified studies within the analysis group"""
    job = anaGroup.CreateJob()
    job.SetValue(u"Title", anaGroup.GetName())
    job.SetValue(u"Queued", True)
    job.SetValue(u"NumOfJobs", 1)
    job.SetValue(u"CheckConflict", False)
    job.SetValue(u"IgnoreGeometryError", False)
    job.SetTargetStudyList(tgtStudyNmArray)
    # run job
    # True :Analysis of all cases
    # False:Run analysis of the current case
    job.Submit(False)
    # Wait until the job completes execution
    job.WaitForFinished()

app = designer.GetApplication()
anaGroup = app.GetCurrentAnalysisGroup()
tgtStudyNmArray = [u"NoLoad", u"Load", u"Demagnetization"]
submitActiveCaseToQueue(anaGroup, tgtStudyNmArray)
anaGroup.CheckForNewResults()

Download Python source code

How to use script file

Use the JMAG Script Library after reading and agreeing to the following terms of use.

Search Filter

  • All Categories

An engineer's diary
JMAG-Express Online