Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Creating a looping time dependent variable
Posted 29 oct. 2022, 07:21 UTC−4 General, Heat Transfer, Equation-Based Modeling Version 5.5 3 Replies
Please login with a confirmed email address before reporting spam
Hello, I'm busy creating a model in Comsol to imitate the additive manufacturing process. Right now I'm trying to create a variable (tlay) which corresponds to the live timing for a single layer. For example, when the total time to deposit one layer is twenty seconds, the variable tlay should loop from 0 to 20 seconds and then repeat itself again. My idea was to create a state variable which does this but for some reason it doesn't really work and I'm not exactly sure why. I expressed the state variable in the following way.
state: Tlay Initial: t Update expression: if(tlay>timeTotal,(tlay-timeTotal),t)
The variable tlay works as intended for the first two iterations as you can see in the graph below where tlay is illustrated against the time. However after this the variable is all over the place and I can't really figure out why is this the case. Any help how to solve this is really appreciated. Thanks!
Attachments: