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.

How to solve a series of functions based on the result of each step

Please login with a confirmed email address before reporting spam

Hi, I'm working on a time dependent heat transfer problem. At the end of each time step, I need to calculate some values based on the result from comsol solving nonisothermal model. I need to use the integral of Temperature Gradient along a wall for each time step, but there's no differential equation, just simple equations. Then I need to use one of the values I got to update my boundary condition for the next step, and store the other values I got.

Could anyone tell me how to make this happen? I tried adding mathematics opperator, but I didn't find a proper opperator that I can use. I've struggled on it for a long time. Didn't find the way I should do with Comsol. Any help will be appreciated please.

Thank you


6 Replies Last Post 14.01.2019, 18:03 GMT-5
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 12.11.2018, 08:00 GMT-5

Have you looked into using a coupling operator? An integration coupling operator may be what you need. See COMSOL Multiphysics Reference Guide, version 5.4, page 316 and following.

Best regards,

Jeff

-------------------
Jeff Hiller
Have you looked into using a coupling operator? An integration coupling operator may be what you need. See COMSOL Multiphysics Reference Guide, version 5.4, page 316 and following. Best regards, Jeff

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 12.11.2018, 13:09 GMT-5

Have you looked into using a coupling operator? An integration coupling operator may be what you need. See COMSOL Multiphysics Reference Guide, version 5.4, page 316 and following.

Best regards,

Jeff

Hi, Jeff Thanks a lot for your reply. I tried the integral operator, as my understanding, this operator only defined the integral area (like a wall in my problem), and when I use it, I type intop1(abc) to call this operator, is that right? But where should I call it and use the integral to compute other values? Just like what I stated in my question, I need to solve 3 functions at the end of each time step, and store some values I got here, also to update my boundary condition of next time step. I'm thinking of using Boundary ODEs and DAEs, but my functions are not ODEs actually, they are just algebraic equations. I tried typing my functions in algebraic equation, but I didn't find my dependent variables calculated at the end of one time step.

Thanks again, appreciate your help in advance.

Jing

>Have you looked into using a coupling operator? An integration coupling operator may be what you need. See COMSOL Multiphysics Reference Guide, version 5.4, page 316 and following. > >Best regards, > >Jeff Hi, Jeff Thanks a lot for your reply. I tried the integral operator, as my understanding, this operator only defined the integral area (like a wall in my problem), and when I use it, I type intop1(a*b*c) to call this operator, is that right? But where should I call it and use the integral to compute other values? Just like what I stated in my question, I need to solve 3 functions at the end of each time step, and store some values I got here, also to update my boundary condition of next time step. I'm thinking of using Boundary ODEs and DAEs, but my functions are not ODEs actually, they are just algebraic equations. I tried typing my functions in algebraic equation, but I didn't find my dependent variables calculated at the end of one time step. Thanks again, appreciate your help in advance. Jing

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 12.11.2018, 13:35 GMT-5

Hi Jing,

You are correct about the syntax for the integration operator: it takes its argument between parentheses.

If I understand correctly, you are trying to solve three scalar algebraic equations, each of which includes one or more integrals. So first, you create the integration operators as we've talked about, then you set up the algebraic equations using "Global ODEs and DAEs", which you will find in the Model Wizard under Mathematics > ODE and DAE Interfaces. You can then use the variables from those equations elsewhere else in your model by calling them by name.

Best,

Jeff

-------------------
Jeff Hiller
Hi Jing, You are correct about the syntax for the integration operator: it takes its argument between parentheses. If I understand correctly, you are trying to solve three scalar algebraic equations, each of which includes one or more integrals. So first, you create the integration operators as we've talked about, then you set up the algebraic equations using "Global ODEs and DAEs", which you will find in the Model Wizard under Mathematics > ODE and DAE Interfaces. You can then use the variables from those equations elsewhere else in your model by calling them by name. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 18.12.2018, 18:18 GMT-5

Hi, Jeff, Your last reply helped a lot. I used "Global ODE and DAE" and got what I need. Thank you so much for your clear explanations. Now I met a new problem, I need to do an integral along a part of one boundary. You know if I use Component couplings and coupling operators>Integration, I can select the boundary that I'd like to integral. In my model, there's a vertical wall (say y=0 to 1), but now I need to do the integral from y=0 to y=y, which means I need to calculate a value for each point on that wall, and I also need them to update the boundary condition for next time step. Do you think it's possible to do with Comsol? Thanks for your time again.

Jing

Hi, Jeff, Your last reply helped a lot. I used "Global ODE and DAE" and got what I need. Thank you so much for your clear explanations. Now I met a new problem, I need to do an integral along a part of one boundary. You know if I use Component couplings and coupling operators>Integration, I can select the boundary that I'd like to integral. In my model, there's a vertical wall (say y=0 to 1), but now I need to do the integral from y=0 to y=y, which means I need to calculate a value for each point on that wall, and I also need them to update the boundary condition for next time step. Do you think it's possible to do with Comsol? Thanks for your time again. Jing

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 19.12.2018, 11:55 GMT-5

Hi Jing,

This blog should help.

Best,

Jeff

-------------------
Jeff Hiller
Hi Jing, [This blog](https://www.comsol.com/blogs/integrals-with-moving-limits-and-solving-integro-differential-equations/) should help. Best, Jeff

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 14.01.2019, 18:03 GMT-5

Hi, Jeff, I found out I still couldn't get my boundary condition updated correctly for each time step. Here's my model: (not as complecate as it may look like)

At each time step, Comsol solve the nitf1 (laminar flow, heat transfer model). I define heat flux as my boundary condition. I use Global ODEs and DAEs to calculate one value h2, it's related to h1 and intop1(heat flux), and also value Z2, related to Z1, h2,h1 and intop1(heat flux) all good so far. I also need to calculate Pz, related to h2,h1,Z2,Z1, intop1(heat flux), and y coordinate, Pz is used to update my boundary condition for the next time step. I use Boundary ODEs and DAEs to define it.

Here's my problem: 1.How can I use Pz to update my boundary condition for the next time step, but not affect the boundary condition for this time step? 2. My 2nd goal is to store h2 and Z2 for every time step, but how can I update h2? I want to make it like h2=........, h1=h2, then use new h1 for next step, but I don't know how to make it work in Comsol.

I've tried hard making my question clear, hope you can understand what I mean. I feel it's possible to make it with Comsol, but I searched many thread in forum still didn't find an answer.

Thank you soooooo much.

Best. Jing

Hi, Jeff, I found out I still couldn't get my boundary condition updated correctly for each time step. Here's my model: (not as complecate as it may look like) At each time step, Comsol solve the nitf1 (laminar flow, heat transfer model). I define heat flux as my boundary condition. I use Global ODEs and DAEs to calculate one value h2, it's related to h1 and intop1(heat flux), and also value Z2, related to Z1, h2,h1 and intop1(heat flux) all good so far. I also need to calculate Pz, related to h2,h1,Z2,Z1, intop1(heat flux), and y coordinate, Pz is used to update my boundary condition for the next time step. I use Boundary ODEs and DAEs to define it. Here's my problem: 1.How can I use Pz to update my boundary condition for the next time step, but not affect the boundary condition for this time step? 2. My 2nd goal is to store h2 and Z2 for every time step, but how can I update h2? I want to make it like h2=........, h1=h2, then use new h1 for next step, but I don't know how to make it work in Comsol. I've tried hard making my question clear, hope you can understand what I mean. I feel it's possible to make it with Comsol, but I searched many thread in forum still didn't find an answer. Thank you soooooo much. Best. Jing

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.