Calculating principle stresses (Difficult)
I would like to calculate the principle normal and shear stresses for the effective stress tensor. Calculating the components of this tensor is trivial.
However, in order to calculate the principle stresses you need to solve a cubic equation. While exact analytical solutions for cubic equations are available they all seem (AFAIK) to require imaginary numbers even if the final roots are strictly real (as in my case). This is a problem as CFX Post does not support imaginary numbers. The other option is to find the roots numerically. However, this cannot (AFAIK) be implemented in an expression for a CFX Post variable. Ergo, Im stuck ... Any suggestions? I could extract the tensor field from CFX Post and do the calcs in a third party app but that would break the optimisation loop I need CFX Post to function in. Suggestions? 
Re: Calculating principle stresses (Difficult)
Joe,
you could write a perl subroutine that performs this task, and call it from within a Post session file, or even a macro. There should be examples of how to do this using 'power syntax' in the Post documentation. Regards, Johnson 
Re: Calculating principle stresses (Difficult)
I thought of that but I need to calculate the principle stresses for the entire domain. You cant incorporate perl expressions into Posts expression definitions AFAIK.

Re: Calculating principle stresses (Difficult)
To elaborate, as I understand it, expressions used to define new variables in CFX post (e.g. varNew = Velocity u + Velocity v)are executed in a vector manner. Or is the expression provided executed with a separate function call for each point in the domain sequentially?
If the second case applies then I would be in business ... 
Re: Calculating principle stresses (Difficult)
Found a solution. If you can calculate one root without imaginary numbers (which is always possible) you can calculate the other two roots by solving a quadratic equation without the use of imaginary numbers.

Re: Calculating principle stresses (Difficult)
If you ever do need to use Perl in CFX Post as part of an optimisation loop, you can! I know, because I do it. You can run a User Defined macro which allows the inclusion of Perl. This macro can be called from a session file and hence can be run in batch mode with no user intervention. I haven't used imaginary numbers (because what I'm doing doesn't need it), but I see no reason why you couldn't.

All times are GMT 4. The time now is 16:27. 