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.

Maximum concentration value in 2D diffusion problem

Please login with a confirmed email address before reporting spam

Hi guys,

I like to make a 2D simulation to show concentration of a particle by the flux of boundary.

I could make the simulation without maximum concentration value.

However, I like to insert the maximum constraint in the simulation.

How can I do this? Can you give some idea?


Thanks,
Cheolwoong

1 Reply Last Post 2010年7月24日 GMT-4 02:44
Ruud Borger COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月24日 GMT-4 02:44
Hello Cheol,

You can implement this by using two ingredients:
-A maximum operator
-an IF statement

I will first explain how to use them in general, and then how to apply them to your model.

For the maximum operator: Right click "Definitions", then go to "Model Couplings", and go for.... you guessed it, "Maximum". Add your domain. Give it a name like "max_con"

Now you've made an operator that calculates the maximum value of any expression in your domain. The expression you want to evaluate should be given as argument to the operator. For concentration, use it as: max_con(c).

Now, for the if-statement: it needs 3 arguments: a condition, expression 1, expression 2. If the condition is true, then the first expression is used. If not, the second expression is used. Easy enough!

What you can now do is set your influx to the following value:
if(max_con(c)<c_max, my_flux,0)

What this does is give your influx a value of my_flux as long as the maximum concentration is lower than c_max. There might be a more delicate approach, but this is the first thing that springs to mind, and I think it will work quite well.
Hello Cheol, You can implement this by using two ingredients: -A maximum operator -an IF statement I will first explain how to use them in general, and then how to apply them to your model. For the maximum operator: Right click "Definitions", then go to "Model Couplings", and go for.... you guessed it, "Maximum". Add your domain. Give it a name like "max_con" Now you've made an operator that calculates the maximum value of any expression in your domain. The expression you want to evaluate should be given as argument to the operator. For concentration, use it as: max_con(c). Now, for the if-statement: it needs 3 arguments: a condition, expression 1, expression 2. If the condition is true, then the first expression is used. If not, the second expression is used. Easy enough! What you can now do is set your influx to the following value: if(max_con(c)

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.