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.

1D line plot in 2D axisymmetric geometry

Clarissa Amaral da Silva

Please login with a confirmed email address before reporting spam

Hi!

I have a model with a 2D axisymmetric geometry and now, for the postprocessing, I need a 1D plot line that goes from -r to r, instead of just 0 to r.

I used the 2D revolution, then "Cut Line" to define the line where I want to evaluate my results, and when I plot it it's ok, as long as I use "Arc Length" for my x-axis. When I change the expression to "r", it only plots my results from 0 to r. I tried to define a range for my x-axis using "range(-x,step,x)", but COMSOL doesn't accept that range as an expression.

I'm attaching a couple of figures so it's easier to understand what I mean. In both figures I used exactly the same data set (cut line), only changed the expression for x.

Can anyone help me with this?

Thanks!

Clarissa



4 Replies Last Post 21.02.2018, 08:16 GMT-5
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 21.02.2018, 07:19 GMT-5

Clarissa,

if I understand the issue properly, a simple way to achieve what you want is to add a second line plot using -r as x-axis expression.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Clarissa, if I understand the issue properly, a simple way to achieve what you want is to add a second line plot using -r as x-axis expression. Cheers Edgar

Clarissa Amaral da Silva

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 21.02.2018, 07:56 GMT-5

Hi Edgar,

Thank you for the response.

I did think of that, and technically that would solve the problem. My only issue with it is the "color matching" of the lines. The figures that I uploaded are a bit simplified and only contain the plots for two different times. I actually have around 6 different times for which I'm plotting the data. Now, for the line settings, I just use the cycle coloring, but if I add another line plot with the expression -r and all 6 times, the colors on one side of the graph won't match the colors on the other side.

The solution I see for that is to add 6 different lines, one for each time (instead of one line plot with multiple times) and manually pick the colors to match whatever I have on the first plot. I think I'll do that for now, but I was hoping there would be a better way to do this.

Thanks again for the fast response!

Best, Clarissa

Hi Edgar, Thank you for the response. I did think of that, and technically that would solve the problem. My only issue with it is the "color matching" of the lines. The figures that I uploaded are a bit simplified and only contain the plots for two different times. I actually have around 6 different times for which I'm plotting the data. Now, for the line settings, I just use the cycle coloring, but if I add another line plot with the expression -r and all 6 times, the colors on one side of the graph won't match the colors on the other side. The solution I see for that is to add 6 different lines, one for each time (instead of one line plot with multiple times) and manually pick the colors to match whatever I have on the first plot. I think I'll do that for now, but I was hoping there would be a better way to do this. Thanks again for the fast response! Best, Clarissa

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 21.02.2018, 08:07 GMT-5

Hi Clarissa,

The Cut Line data set does not redefine the independent variables (space variables) in the underlying data sets, so, for example, r, x, y, and z will behave as they would before. In an axisymmetric geometry, it means that .

What you can do is to use an expression that includes the local space variable for the Cut Line data set, which you find in the Advanced section, which has the same values as the arc length: . If you name it r2, for example, and the radius of the geometry is, say, 0.5, then using an expression r2-0.5 will give you an x-axis than runs from -0.5 to 0.5.

Best regards,

Magnus Ringh, COMSOL

Hi Clarissa, The Cut Line data set does not redefine the independent variables (space variables) in the underlying data sets, so, for example, r, x, y, and z will behave as they would before. In an axisymmetric geometry, it means that r\geq0. What you can do is to use an expression that includes the local space variable for the Cut Line data set, which you find in the Advanced section, which has the same values as the arc length: 0 - 2r. If you name it ` r2`, for example, and the radius of the geometry is, say, 0.5, then using an expression `r2-0.5` will give you an x-axis than runs from -0.5 to 0.5. Best regards, Magnus Ringh, COMSOL

Clarissa Amaral da Silva

Please login with a confirmed email address before reporting spam

Posted: 7 years ago 21.02.2018, 08:16 GMT-5

Hi Magnus,

That works perfectly! Thank you!!

Best, Clarissa

Hi Magnus, That works perfectly! Thank you!! Best, Clarissa

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.