Skip to content Skip to sidebar Skip to footer

Does Comsol Automatically Upload Results as You Change

Little-known functionality of the Study node is its ability to perform a programmatic sequence of operations, including solving; saving the model to file; and generating and exporting plot groups, results, and images. In this web log mail, we take a closer expect at this adequacy. If yous use the COMSOL Multiphysics® software, there is a practiced chance you lot will find this data useful in your modeling work.

Example: Micromixer Model

To demonstrate this functionality, we will kickoff load the Micromixer tutorial model from the Application Libraries. This model is bachelor in the binder COMSOL Multiphysics > Fluid Dynamics and illustrates fluid flow and mass transport in a laminar static mixer.

A cropped screenshot of the Application Libraries in COMSOL Multiphysics with the micromixer tutorial selected.

The model performs a fluid flow simulation using a Laminar Flow interface. In the next step, information technology shows how to summate the mixing efficiency by means of a Send of Diluted Species interface, using the results from the fluid flow simulation equally input. The species will be transported downstream based on the fluid velocity.

The computation time for this model is a few minutes. To simplify the model a bit so that we tin run the ciphering quicker, we won't solve for the species send. To achieve this, we will make i modification to the Settings window of the second study pace, Step ii: Stationary 2, past clearing the Ship of Diluted Species check box.

A screenshot of COMSOL Multiphysics with the Stationary study Settings window open.

Nosotros tin can make an boosted change to the model in society for it to run faster. Set the Sequence blazon for the mesh to Physics-controlled mesh and the element size to Extremely coarse.

A cropped screenshot of the Model Builder in COMSOL Multiphysics with the Mesh node highlighted.

At present, we tin compute Report 1 to make certain everything works. The resulting plot shows the velocity magnitude at a few slices along the mixer geometry.

The COMSOL software GUI with a micromixer model in the Graphics window.

Using Job Sequences to Salve Data

Here, we will focus our attention on ane of import part of a chore configuration: the Sequence option.

To be able to ascertain a sequence of operations under the Written report node, we enable Avant-garde Report Options. This is an bachelor carte du jour selection under the Model Builder toolbar. Click the "middle" symbol to see the menu.

A cropped screenshot showing the Advanced Study Options enabled in COMSOL Multiphysics.

Enabling this setting reveals a hidden Job Configurations node in the model tree. This node is something that you lot don't demand to worry about during conventional modeling work. Information technology essentially stores depression-level information pertaining to the order in which the solution process should exist run. Normally, this is controlled indirectly from the peak level of a report without the demand for enabling Advanced Study Options.

Right-click Chore Configurations and select Sequence.

A cropped screenshot of COMSOL Multiphysics after right-clicking the Job Configurations node.

Next, correct-click Sequence to meet, below the Run choice, a diverseness of options that can be added as an ordered sequence of operations performed when running the sequence:

  • Job
  • Solution
  • Other
  • Save Model to File
  • Results

Chore refers to some other sequence that is to be run from this sequence, while Solution runs a Solution node as available under the Solver Configurations node, available farther up in the Written report tree.

Nether Other, you lot tin cull External Form, which calls an external Java® class file. Some other option, Geometry, builds the Geometry node. This can exist used, for example, in combination with a parametric sweep to generate a sequence of MPH-files with different geometry parameters. The Mesh option builds the Mesh node.

Save Model to File saves the solved model to an MPH-file.

Under the Results option, you lot can choose Plot Grouping to run all or a selected set of plot groups. This is useful to automate the generation of plot groups subsequently solving. You likewise don't have to manually click through all of the plot groups to generate the respective visualizations. The Derived Value option is there for legacy reasons and nosotros recommend that y'all use the Evaluate Derived Values option, which will evaluate nodes under Results > Derived Values. The pick Export to File runs whatsoever node for data consign under the Export node.

Let'southward now create a simple sequence. Correct-click the Sequence node and select Solution.

A cropped screenshot of COMSOL Multiphysics after right-clicking the Sequence node.

The default option for a Solution node in a sequence is to run all solution nodes. The Run option in the General section lets you specify which Solution data structures should exist computed. The Solution data structures are bachelor as child nodes, together with other nodes, under Solver configurations. They can be recognized by their short proper name written within parentheses, such equally (sol1) and (sol2). The solution data structures are low-level representations of the solutions.

In this example, you can go on the default All for the Solution information structures.

A screenshot of COMSOL Multiphysics with the Solution Settings window open.

Nosotros would similar to save the file when the solver is finished. Right-click the Sequence node and select Save Model to File.

A screenshot of COMSOL Multiphysics with the Save the Model to File Settings window open.

In the Settings window, you lot tin see a number of options that are related to the capability of saving a serial of MPH-files with parameters added at the finish of the file name. This is very useful for parametric sweeps such as batch sweeps. Still, we will not need to exercise this in such a unproblematic example, so we change the pick Add parameters to filename to None. At this stage, we as well need to give a file proper noun to a location where nosotros accept permission to write. In this example, the file name and path is C:\COMSOL\myfile.mph.

A screenshot of COMSOL Multiphysics with the Sequence Settings window open.

To run these operations, select the Sequence node and click Run.

Writing Data to File After Solving in COMSOL Multiphysics®

The library model that we started from already has one defined derived value. Yous can meet this nether Results > Derived Values > Global Evaluation. The variable is called S_outlet and is the relative concentration variance at the outlet. It is defined as a variable under Component > Definitions > Variables.

A screenshot of COMSOL Multiphysics with the Global Evaluation Settings window open.

The value of S_outlet is sent to Table one. Nosotros can cull to store this value on file by irresolute a setting in the Settings window of Table i. Change Store table to On file and blazon a file name; for example, C:\COMSOL\my_data.txt.

A screenshot of COMSOL Multiphysics with the Table Settings window open.

At present, add an Evaluate Derived Values operation to the sequence.

A screenshot of COMSOL Multiphysics with the Evaluate Derived Values Settings window open.

In the General section, you can change the Evaluate setting to Global Evaluation 1. However, in this simple example model, y'all can omit this step. Notation that the name of the node in the model tree changes to Evaluate: Global Evaluation 1.

You tin can at present run the sequence once more. However, for this final step to make sense, yous need to enable the Transport of Diluted Species interface in the Settings window for Step 2: Stationary 2.

Running Chore Sequences from the Command Line

If y'all want to run a job sequence from the control line in the Windows® or Linux® operating systems, or macOS, you cannot use the method shown to a higher place, but instead you need to add a parametric sweep with a dummy parameter. Still, if you were already running a parametric sweep, so all you need to know is that a parametric sweep is just a special type of job sequence and then follow the instructions in a higher place, but with a Job Configurations>Parametric Sweep node replacing a Job Configurations>Sequence node.

The reason for this is historical and reflects the evolution of the Study node functionality over time. The operating arrangement control interface doesn't permit you run any part of a Written report node that is non controlled at the pinnacle level of the Report node. You tin can only specify which study to run, for example, in the Linux® operating organisation:

comsol batch -inputfile mymodel.mph -study std1

for Study one with tag std1.

You cannot run a sequence in this fashion, since the top-level study step is unaware of your edits nether the Job Configuration node. To make the study stride at the summit of the Written report node tree "enlightened" of your edits nether the Task Configurations node, the easiest mode is to add a parametric sweep with an arbitrary parameter defined nether Global Definitions > Parameters; say, dummy with value 1. Sweeping over this parameter so adds the extra overhead needed to get a handle on the Task Configuration node from the acme level of the Written report node. Then, you can issue a control-line batch control to run it.

This is how the respective "dummy" sweep will look:

A screenshot of COMSOL Multiphysics with the Parametric Sweep Settings window open.

The post-obit figure shows the corresponding sweep over ane parameter value for the dummy parameter.

A screenshot of COMSOL Multiphysics showing the Parametric Sweep 1 settings for the dummy parameter.

At present, knowing that the Parametric Sweep 1 node is just a special blazon of Sequence node, the child nodes Solution one, Save Model to File 1, and Evaluate: Global Evaluation 1 are merely every bit they are in the example higher up using Sequence.

Enable the display of model tree tags past selecting Tag from the Model Tree Node Text menu, available in the Model Builder toolbar.

A cropped screenshot of the Model Builder in COMSOL Multiphysics with the Tag option selected.

The study tag std1 is now visible in the model tree:

A screenshot of the model tree in COMSOL Multiphysics zoomed in on the study tag std1.

The Linux® control shown before will at present run the sequence of operations that solves, saves the model to file, and finally evaluates the Global Evaluation node. Note that if y'all only have one Written report node in your model, then you lot tin can skip the input argument report std1.

Note that if y'all already have a parametric sweep in your model, these tin be of 2 types loosely referred to as "inner sweep" and "outer sweep". The sweep in the example above using the dummy parameter is an "outer sweep". The Report node will autodetect which type of sweep to utilise for all-time performance, only y'all tin take control manually, if needed. In guild to use a job sequence from the control line, your sweep needs to be an "outer sweep".

More than or less all types of sweeps can exist changed from existence an inner sweep to an outer sweep, just non the other way around. Inner sweeps can be faster, since they volition use some of the underlying structure of the ciphering to speed things upwardly. Notwithstanding, non all types of sweeps can be inner sweeps. For case, a sweep over a geometry parameter always needs to be an outer sweep; again, this is handled automatically by the solver. To make sure the parameter sweep is an outer sweep, change the Utilize parametric solver to Off in the Parametric Sweep settings, so perform a Prove default solver operation and go along from there.

Summary

Job sequences tin can be used to automate a number of common tasks afterwards solving a model. In this blog mail, we have seen examples of:

  • Saving the model to file as an MPH-file after solving
  • Exporting Derived Values to file automatically after solving

There are other tasks that use task sequences that y'all tin endeavour on your own, including:

  • Regenerating all plots later solving
  • Exporting plot data to file
  • Exporting prototype data to file

We promise you find that chore sequences are a useful feature for your everyday modeling piece of work!

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United states of america and/or other countries. Linux is a registered trademark of Linus Torvalds in the U.South. and other countries. macOS is a trademark of Apple Inc., registered in the U.Southward. and other countries.

eckardeventable.blogspot.com

Source: https://www.comsol.com/blogs/how-to-use-job-sequences-to-save-data-after-solving-your-model/

Publicar un comentario for "Does Comsol Automatically Upload Results as You Change"