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.

need your comments

Please login with a confirmed email address before reporting spam

Hey Everyone, a complete naive question here, but please I need your comments on this expression:

Z=A*exp(-D)*((X<P)+(X>=P)*exp(D))

What these conditions ((X<P), (X>=P) says, and hence what is the final expression.
I know this is an if else kinda stuff but I am little bit confused!!

Regards,
E

5 Replies Last Post 2010年11月17日 GMT-5 09:15
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月16日 GMT-5 01:24
Hi

you can use bolean equations such as (x<1) in an expression which means that the results of the () is either 1 if x is strictly smaller than 1, or is equal to 0 otherwise. In your case you have two bolean operatins so you have different cases on each side of the limit "X" .

Such expressions have the danger that the abrupt changes in values might give some headaches to the solver, and you might not converge, it all depends ...

Furthermore, if you have an uppercase "X" its probably that you are in the "spatial frame" (see the doc 4.1 about the frames)

--
Good luck
Ivar
Hi you can use bolean equations such as (x

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月16日 GMT-5 05:44
Hi,

There is something weird in this logical function:
Generally, the logical expression can be written as :

F=(M value or expression)*(condition1 && condition2)
This means that the value of F is equal to M if condition 1 AND 2 are fulfilled!

F=(N value or expression)*(condition3 | condition4)
This means that the value of F is equal to N if condition 3 OR 4 is fulfilled!

You can combine both of them as:
F=(M value or expression)*(condition1&&condition2) + (N value or expression)*(condition3 | condition4) which covers the whole range.

But in your expression Z=A*exp(-D)*((X<P)+(X>=P)*exp(D))
You are saying that the value of Z is equal to A*exp(-D) if (X<P)+(X>=P)*exp(D) !!! The condition is wrong

I guess you are trying to express it as: Z=A*exp(-D)*(X<P)+exp(D)*(X>=P) ?? This is correct!

I hope it helps!!

Cheers
Hi, There is something weird in this logical function: Generally, the logical expression can be written as : F=(M value or expression)*(condition1 && condition2) This means that the value of F is equal to M if condition 1 AND 2 are fulfilled! F=(N value or expression)*(condition3 | condition4) This means that the value of F is equal to N if condition 3 OR 4 is fulfilled! You can combine both of them as: F=(M value or expression)*(condition1&&condition2) + (N value or expression)*(condition3 | condition4) which covers the whole range. But in your expression Z=A*exp(-D)*((X=P)*exp(D)) You are saying that the value of Z is equal to A*exp(-D) if (X=P)*exp(D) !!! The condition is wrong I guess you are trying to express it as: Z=A*exp(-D)*(X=P) ?? This is correct! I hope it helps!! Cheers

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月16日 GMT-5 09:50
Hi

I missed that one ;)

--
Good luck
Ivar
Hi I missed that one ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月17日 GMT-5 06:59
thanks for your suggestion and I Double checked the form of expression I want to express, (as given in the Diode model)
Z=A*exp(-D)*((X<P)+(X>=P)*exp(D))
as I have just started to explore comsol, I cant say for sure but,
I guess the final expression would be Z= A*exp(-D) for X<P

and A*exp(-D)*exp(D) for X>= P
maybe because only one of the condition could be true at a time,
Is it correct....??


Regards,
E
thanks for your suggestion and I Double checked the form of expression I want to express, (as given in the Diode model) Z=A*exp(-D)*((X=P)*exp(D)) as I have just started to explore comsol, I cant say for sure but, I guess the final expression would be Z= A*exp(-D) for X= P maybe because only one of the condition could be true at a time, Is it correct....?? Regards, E

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年11月17日 GMT-5 09:15
Hi,

Yes, you are right. The expression exists in the diode model!!

To understand it, I just used equivalent expression
F=A*((x<5)+(x>=5)*b)
If you plot this expression in Comsol functions you will observe that:
When x<5 F= A
When x>=5 F=A*b

The A is a common factor for the two logical conditions. A*(condition1+condition2*expression)
It is just a compacted writing of this logical function (something which is absent in the doc!!)
You can even re-write it in a simple manner as I have described above.

At least I learned something new today ;-)

I hope it helps

Cheers
Hi, Yes, you are right. The expression exists in the diode model!! To understand it, I just used equivalent expression F=A*((x=5)*b) If you plot this expression in Comsol functions you will observe that: When x=5 F=A*b The A is a common factor for the two logical conditions. A*(condition1+condition2*expression) It is just a compacted writing of this logical function (something which is absent in the doc!!) You can even re-write it in a simple manner as I have described above. At least I learned something new today ;-) I hope it helps Cheers

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.