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.

Unitary vector in a cartesian system

Please login with a confirmed email address before reporting spam

Hi,

I am a beginner in COMSOL....I have an expression using the unitary vectors of the cartesian basis :
ux = (1,0,0)
uy = (0,1,0
uz = (0,0,1)

What is the script in COMSOL to write ux , uy and uz using a cartesian system ?

In particular my expression is |2* ux + 3*uy - 4*uz| , |...| is the norm of the vector in argument.

I know that the solution for this basic example is to write |...| = sqrt(2^2 + 3^2 + 4^2) but I prefer use the first expression for my calculations (I mean with ux, uy, uz).

Thank you for your help

Claire

3 Replies Last Post 17 lug 2010, 16:38 GMT-4
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 17 lug 2010, 04:49 GMT-4
Hi

note that ux uy uz are the internal COMSOl notations for the space derivative of the displacement vector, so do your best to keep clear of COMSOLs numerous internal names.

For the rest why not create a function as sqrt(aa^2+bb^2+cc^2) and use aa,bb,cc or whatever other name. Basically in COMSOL you can write in an equation in most if not all fields

Good luck
Ivar
Hi note that ux uy uz are the internal COMSOl notations for the space derivative of the displacement vector, so do your best to keep clear of COMSOLs numerous internal names. For the rest why not create a function as sqrt(aa^2+bb^2+cc^2) and use aa,bb,cc or whatever other name. Basically in COMSOL you can write in an equation in most if not all fields Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17 lug 2010, 13:49 GMT-4
Hi Ivar,

Thank you for your response ! It is true that ux, uy and uz are already used by COMSOL for derivation.

Your solution is very useful only for simple expression whose norm is known (like in my example in my previous post). In fact, the right expression of my problem is much more complicated and I have to write a script using the unit vectors (I mean vx = (1,0,0) , vy = (0,1,0) and vz = (0,0,1)) and perform with comsol the norm of my vector expression.
I do not know what is the command/script to write these vectors...

Mayby COMSOL works only with numerical expressions ?

Best

Claire
Hi Ivar, Thank you for your response ! It is true that ux, uy and uz are already used by COMSOL for derivation. Your solution is very useful only for simple expression whose norm is known (like in my example in my previous post). In fact, the right expression of my problem is much more complicated and I have to write a script using the unit vectors (I mean vx = (1,0,0) , vy = (0,1,0) and vz = (0,0,1)) and perform with comsol the norm of my vector expression. I do not know what is the command/script to write these vectors... Mayby COMSOL works only with numerical expressions ? Best Claire

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 17 lug 2010, 16:38 GMT-4
Hi
I still do not fully catch your question, I believe.

You can absolutely use expressions (and not only numerical values) in the Comsol GUI fileds.

But, this applies to scalars; vectors are not permitted (I belive just for a few exceptions) so you need to split up the equations into the specific components as separate variables, (a norm remains though a scalar). Comsol has many internal variables (check the doc) including normals to boundaries and these can be used too.

One way is clearly to export everything to Matlab and write your equations that way, but much can also be done internally (even more in V4) with the help of user defined functions and the internal variables.

Good luck
Ivar
Hi I still do not fully catch your question, I believe. You can absolutely use expressions (and not only numerical values) in the Comsol GUI fileds. But, this applies to scalars; vectors are not permitted (I belive just for a few exceptions) so you need to split up the equations into the specific components as separate variables, (a norm remains though a scalar). Comsol has many internal variables (check the doc) including normals to boundaries and these can be used too. One way is clearly to export everything to Matlab and write your equations that way, but much can also be done internally (even more in V4) with the help of user defined functions and the internal variables. Good luck Ivar

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.