Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
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.
vector dot product
Posted 21 giu 2010, 04:29 GMT-4 Version 4.0a, Version 4.2a 7 Replies
Please login with a confirmed email address before reporting spam
I was wondering if we could evaluate vector dot products between vector fields? If yes, it would really help a lot in enhancing the way we can use field overlap integrals, among others, in postprocessing.
I am presently using 3.5a but if it is possible only in 4.0 then it might speed up my transition to 4.0.
Please login with a confirmed email address before reporting spam
you can enter any equation in the postprocessing. So if you have a vector field A=(Ax, Ay, Az) and a vector field B=(Bx, By, Bz) just enter the expression AxBx+AyBy+AzBz. You can also define an expression like dotproduct=AxBx+AyBy+AzBz and use it in postprocessing or anywhere else.
You are not restricted to the suggestions COMSOL gives you. You can use any variable, internal ones and the expressions you define yourself.
Regards
Edgar
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
there are still some subtilities for complex values, check the "realdot()" operator, usefull among other for EM/RF fields, but also in other cases
Have fun Comsoling
Ivar
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
check the "realdot()" operator
the relevant section from 4.0a,
The Realdot Operator
• The expression realdot(a,b) treats complex numbers a and b as if they were real-valued vectors of length 2 and returns their dot product. You can also think of the operator call as a shorthand form of real(a*conj(b)). This expression, however, is not an analytical function of its complex arguments and therefore has no unique partial derivatives with respect to a and b.
• The difference between realdot(a,b) and real(a*conj(b)) is that the partial derivatives of the former with respect to a and b are defined as conj(b) and conj(a), respectively, while for the latter expression, the partial derivatives are real(conj(a)) and real(a).
• The difference between the partial derivative definitions is important during sensitivity analysis of frequency-response problems (scalar or vector Helmholtz equations).
• Common objective function quantities like power and energy must be redefined in terms of realdot(a,b) rather than real(a*conj(b)) for the sensitivity solver to compute correct derivatives. This applies also to the absolute value, abs(a), via the definition |a|^2 = realdot(a,a).
Please login with a confirmed email address before reporting spam
Is the following expression right?
real= real ( with(1,Ex)*conj(with(2,Ex)) + with(1,Ey)*conj(with(2,Ey)) + with(1,Ez)*conj(with(2,Ez)) );
imaginary= imag ( with(1,Ex)*conj(with(2,Ex)) + with(1,Ey)*conj(with(2,Ey)) + with(1,Ez)*conj(with(2,Ez)) );
Please login with a confirmed email address before reporting spam
I believe so, or you could use the realdot() operator, but I do not believe your equation writing will be simpler
It is a pitty we cannot write out the vector product in a more compressed way
--
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.
