Using Job Configurations to Combine Sequences into a Single Automated Job Run

In this month’s tips and tricks video, I will show you how to use job configurations to combine sequences into a single automated job run, which will enable you to solve for dozens or hundreds of automated layers.

Click below to watch as I walk you through the process. To help you follow along, we have included the video transcription below.

There’s no reason to learn software programs through trial and error, so in addition to our tips and tricks, our upcoming training classes will support you, the COMSOL user, in utilizing best practices with many of the COMSOL modules. Please visit our training calendar and find the course that is best for you.

Using Job Configurations to Combine Sequences into a Single Automated Job Run Transcription

In this Tips and Tricks video I’d like to show you how to use job configurations to setup a sequence of model method in solver calls, combining that sequence into a single automated job run. And we’ve found this tip to be particularly useful in modeling scenarios where there’s a buildup of layers of material over time. One industry example, although that’s not the only one, is in the case of additive manufacturing. And the animation that you’re seeing here, is an example of that exact scenario that I just described, where we have material that is being built up over time, and the thermal simulation shows the hot material being deposited onto the subsequent, or the previous layer, and that there is a cool down that happens in between each layer deposition.

The modeling challenge is that after each layer is deposited, there’s a good bit of manual model modification required before the next computation can be executed. It’s not necessarily hard work but it can be very tedious, and if you have more than two or three layers to simulate, it’s much more efficient and less error-prone to develop a way to automate this process of solving for a layer, making the appropriate boundary condition changes, adding a new layer, solving again, etcetera. This will enable you to solve for dozens, hundreds of layers automated. Also enable you to run parametric sweeps more efficiently, rather having to do all of this work manually. Certainly any optimization that you wanted to run would require this approach.

So, that’s what we’re going to show in this particular video, and the trick really comes down to learning two different skills. The first is that you need to learn how to use the model method code approach that comes through the app builder interface to make the necessary changes to the boundary conditions and physics features in between the layers. And then, secondly you’ll want to develop a sequence under job configurations, that calls those method code scripts in between each study call. And I’ll show you how to do this.

So I have a model here, just a simplified version of the multilayer stackup animation that I showed. It’s got two layers and two different studies that solves for the temperature distribution and time. There’s model method code that you can see here that will adjust the boundary conditions appropriately, and the physics features in between each layer.

And the trick here is that you’ll need to learn how to write that code, now we do offer a class called “App Building Strategy” that we’re going to be rolling out as an online, on-demand class in 2024, so keep an eye out for that. But for now, I’d just like to point out that you do need to develop that method code, and then the trick is using a study job sequence to be able to call that method code to make the appropriate adjustments in between each solver call. So I’ll show you how to do that.

So you can right-click root node ‘Add Study’ and we’re going to add an ‘Empty Study’. Now, ‘Job Configurations’ doesn’t always show up when you first install the software – you do have to click this ‘Show More Options’ button and make sure that this box is checked ‘Solver and Job Configurations’. If it wasn’t checked then you wouldn’t see it. But I’m checked so I see mine show up here. And then I’m going to right-click on ‘Job Configurations’ and select ‘Sequence’  At this point I can right-click on ‘Sequence’ and select ‘Other’, ‘Method Call’ to call the Model Method 1. Now previously maybe all that you knew of model methods is that you would run those from ‘Global Definitions’ by clicking here and clicking ‘Run’  The trick here is that you can actually have COMSOL® automatically run those Method Calls in the sequence here. And so first we’ll call Method 1 to set up the boundary conditions for the first layer deposition. Then we’ll execute the Solver Sequence, Solution 1, which will solve for time zero to day one for the first layer. Then we’ll apply a second Method Call, Method Call 2, to set up the boundary conditions and the physics, material definitions for the second layer deposition. And then we’ll right-click ‘Sequence’ and select ‘Solution’, Solution 2 that will execute Study 2 that solves from day one all the way to day two. And, you can finally add the third Solution Call, which will be the Combined Solutions Feature, Solution 3 that combines the data sets from Study 1 with Study 2. So, you have one seamless data set, so that you can provide animations like the one that I showed at the beginning of this video.

Now instead of clicking Study 1, Compute, Model Method, Study 2, Compute, Study 3, Compute, I can just execute this sequence here by clicking Sequence 1, Run and COMSOL® will automatically go through that entire sequence and enable you to solve for all of those. Now, you would then need to then build that out for 5, 10, 15 layers if you wanted more. But, once you’ve got that workflow built in, it’s much more less prone to errors and ready to do parametric sweeps.

Hopefully you found this tip to be helpful. Thank you.