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.

Reaction term

Please login with a confirmed email address before reporting spam

Hi, I'd like to add reaction term just for the certain time in the diffusion model. For example,
0~3 s : no reaction
3~5 s : reaction
5~7 s : no reaction

I split studies into three parts (one reaction-activated study and two reaction-inactivated studies). However, resulted profile only showed the result from the last study (In the case of above example, study for 5~7s non-reaction study was only present).

Is there any way that I can see those three parts continuously??
I mean, if it's possible, I would like to inactive the reaction term for the certain time in one study..
I couldn't figure out how to deal with it..

Bests,

Woongsun Choi

7 Replies Last Post 06.05.2016, 20:38 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 04.05.2016, 11:03 GMT-4
Hi!

This is the first thing that comes to my mind :
I would try doing it in one study going from 0 to 7 s, and multiply your reaction, let's call it R, by a function, that takes the value 0 from 0 to 3 s, 1 from 3 to 5 and 0 again from 5 to 7 s.
This should be possible by defining a "Rectangle" function in the Definitions node (right-click it) and writing the name of this function*R in your reaction text box.

Best,
Julien
Hi! This is the first thing that comes to my mind : I would try doing it in one study going from 0 to 7 s, and multiply your reaction, let's call it R, by a function, that takes the value 0 from 0 to 3 s, 1 from 3 to 5 and 0 again from 5 to 7 s. This should be possible by defining a "Rectangle" function in the Definitions node (right-click it) and writing the name of this function*R in your reaction text box. Best, Julien

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 06.05.2016, 04:37 GMT-4
Hello, Julien!

Thank you for your advise!

I really agree with your advise.. Here, I have one problem..

I set up an rectangle function shown as attached file which has lower limit of 3 and upper linit of 5.
And I multiplied this rectangle function(rect1) in the reaction text box as : "rect1*R"

However, it seems COMSOL can't recognize the definition of "rect1".

Could you let me know what's wrong here?


Hello, Julien! Thank you for your advise! I really agree with your advise.. Here, I have one problem.. I set up an rectangle function shown as attached file which has lower limit of 3 and upper linit of 5. And I multiplied this rectangle function(rect1) in the reaction text box as : "rect1*R" However, it seems COMSOL can't recognize the definition of "rect1". Could you let me know what's wrong here?


Krishnaswamy Veluswamy

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 06.05.2016, 04:48 GMT-4
Hi woongsun,

I prefer to implement in the function that you specified in the definition > variable >analytic function , and implement the function equation using an If condition statement. lets call the name of the analytic function as an1, which is time dependent.

Now implement the function as an1(t[1/s]) in the place where you want to implement the reaction.

Hope it solves your problem.

-krishnaswamy
Hi woongsun, I prefer to implement in the function that you specified in the definition > variable >analytic function , and implement the function equation using an If condition statement. lets call the name of the analytic function as an1, which is time dependent. Now implement the function as an1(t[1/s]) in the place where you want to implement the reaction. Hope it solves your problem. -krishnaswamy

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 06.05.2016, 05:21 GMT-4
Hello, Julien!

Thank you for your advise!

I really agree with your advise.. Here, I have one problem..

I set up an rectangle function shown as attached file which has lower limit of 3 and upper linit of 5.
And I multiplied this rectangle function(rect1) in the reaction text box as : "rect1*R"

However, it seems COMSOL can't recognize the definition of "rect1".

Could you let me know what's wrong here?
Hello, Julien! Thank you for your advise! I really agree with your advise.. Here, I have one problem.. I set up an rectangle function shown as attached file which has lower limit of 3 and upper linit of 5. And I multiplied this rectangle function(rect1) in the reaction text box as : "rect1*R" However, it seems COMSOL can't recognize the definition of "rect1". Could you let me know what's wrong here?


Please login with a confirmed email address before reporting spam

Posted: 8 years ago 06.05.2016, 05:53 GMT-4
Hi, Krishnaswamy!

Thank you for your reply.

I couldn't find analytic function tap as you taught me.. (the definition > variable >analytic function)

Also, could you show me how to use if condition in analytic function??
Hi, Krishnaswamy! Thank you for your reply. I couldn't find analytic function tap as you taught me.. (the definition > variable >analytic function) Also, could you show me how to use if condition in analytic function??

Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 06.05.2016, 07:46 GMT-4
Hello Woongsun,
When you call any function in COMSOL, such as your function "rect1", you need to indicate what argument the function takes, for instance "rect1(t)".
Best,
Jeff
PS: Using boolean expressions based on time for the purpose of turning terms on and off is not typically recommended, due to the lack of differentiability of those terms: the time dependent solver can miss them.
Hello Woongsun, When you call any function in COMSOL, such as your function "rect1", you need to indicate what argument the function takes, for instance "rect1(t)". Best, Jeff PS: Using boolean expressions based on time for the purpose of turning terms on and off is not typically recommended, due to the lack of differentiability of those terms: the time dependent solver can miss them.

Krishnaswamy Veluswamy

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 06.05.2016, 20:38 GMT-4
Hi woongsun,

I have attached the method of implementation in the jpeg file, you can see the highlighted part in yellow,
I am sorry for explaining you in legitimate way,

so, right click the definition under the component > function > analytic.

I have also highlighted the function name as an1, however you can change it to any name that you like and use it further in your implementation as an1(t[1/s]), this t in the bracket denotes the time dependency in the problem. If you plan to change the function name to func then you need to use it as func(t[1/s]).

Hope it solves your problem.

-krishnaswamy
Hi woongsun, I have attached the method of implementation in the jpeg file, you can see the highlighted part in yellow, I am sorry for explaining you in legitimate way, so, right click the definition under the component > function > analytic. I have also highlighted the function name as an1, however you can change it to any name that you like and use it further in your implementation as an1(t[1/s]), this t in the bracket denotes the time dependency in the problem. If you plan to change the function name to func then you need to use it as func(t[1/s]). Hope it solves your problem. -krishnaswamy

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.