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.

Plot 3D Graph for function c (x,t)

Please login with a confirmed email address before reporting spam

I have a transient problem in 1D geometry.
I found a solution as a function of x [m] and time t [s].

solution = c(x,t) ; c is concentration, x is distance [m], t is time [s].

I know how to plot a 2D graph for concentration c as a function of distance x at each time step.
How to plot a 3D graphics for concentration, with one axis is time and another axis is distance x ?

Thank you very much,
Dao Trinh

4 Replies Last Post Jan 27, 2012, 6:19 p.m. EST
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 Jan 27, 2012, 2:55 p.m. EST
Hi
if you want a 3D "height" plot, you might need to export your data into an interpolation function (you might reimport it I beleive as a x,y Interpolation function and then use the GUI to plot it as a 2D XY plot with Y=t) or use Excel or matlab, as I'm not sure how to plot x,t like that (x,y is a standard 2D plot and there you can add a subnode "height")

Personally I plot 1D line plots "x" with multiple lines for such cases, never really tried what you are proposing
But I do certainly not know all the plotting tricks ;)

--
Good luck
Ivar
Hi if you want a 3D "height" plot, you might need to export your data into an interpolation function (you might reimport it I beleive as a x,y Interpolation function and then use the GUI to plot it as a 2D XY plot with Y=t) or use Excel or matlab, as I'm not sure how to plot x,t like that (x,y is a standard 2D plot and there you can add a subnode "height") Personally I plot 1D line plots "x" with multiple lines for such cases, never really tried what you are proposing But I do certainly not know all the plotting tricks ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 27, 2012, 3:51 p.m. EST
Thank you Ivar.

I want to ask the related problem. I got the solution c(x,t). And I want to get the value dc/dx at x=0 for all time.
I selected Result > Derived Values > Point Evaluation and Select the point x = 0.
And then I typed the Expression is : gradx_c
I got the Table Result, and it works.

My question is : Do we have another method to evaluate the dc/dx at x=0 ? Or the method proposed above is the only one ?

Thanks

Thank you Ivar. I want to ask the related problem. I got the solution c(x,t). And I want to get the value dc/dx at x=0 for all time. I selected Result > Derived Values > Point Evaluation and Select the point x = 0. And then I typed the Expression is : gradx_c I got the Table Result, and it works. My question is : Do we have another method to evaluate the dc/dx at x=0 ? Or the method proposed above is the only one ? Thanks

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 27, 2012, 4:17 p.m. EST

Hi
if you want a 3D "height" plot, you might need to export your data into an interpolation function (you might reimport it I beleive as a x,y Interpolation function and then use the GUI to plot it as a 2D XY plot with Y=t) or use Excel or matlab, as I'm not sure how to plot x,t like that (x,y is a standard 2D plot and there you can add a subnode "height")

Personally I plot 1D line plots "x" with multiple lines for such cases, never really tried what you are proposing
But I do certainly not know all the plotting tricks ;)

--
Good luck
Ivar


I've tried your method. Export the function c(x,t) as a txt file, and reimport the file in Comsol.
It works but not very good, it is hard in Comsol to change the the ratio of the axis. In my case, I got the 3D graph, but one axis is time (run from 0 to 1s) and one axis is distance (run from 0 to 20m). The graph is distort in one direction.
[QUOTE] Hi if you want a 3D "height" plot, you might need to export your data into an interpolation function (you might reimport it I beleive as a x,y Interpolation function and then use the GUI to plot it as a 2D XY plot with Y=t) or use Excel or matlab, as I'm not sure how to plot x,t like that (x,y is a standard 2D plot and there you can add a subnode "height") Personally I plot 1D line plots "x" with multiple lines for such cases, never really tried what you are proposing But I do certainly not know all the plotting tricks ;) -- Good luck Ivar [/QUOTE] I've tried your method. Export the function c(x,t) as a txt file, and reimport the file in Comsol. It works but not very good, it is hard in Comsol to change the the ratio of the axis. In my case, I got the 3D graph, but one axis is time (run from 0 to 1s) and one axis is distance (run from 0 to 20m). The graph is distort in one direction.

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 Jan 27, 2012, 6:19 p.m. EST
Hi

if "c" is a dependent variable, there is a fair chance that COMSOL has already defined cx and cxx and ct ... (provided you have at least a 2nd order, or higher, shape function.

If not, there is a KB article about defining new equation to get more precise derivatives, its tailored for time derivatives, but why not also space derivatives, incase the firs hint is not possible.

Unfortnately I'm not by my COMSOL WS tonight ;)

--
Good luck
Ivar
Hi if "c" is a dependent variable, there is a fair chance that COMSOL has already defined cx and cxx and ct ... (provided you have at least a 2nd order, or higher, shape function. If not, there is a KB article about defining new equation to get more precise derivatives, its tailored for time derivatives, but why not also space derivatives, incase the firs hint is not possible. Unfortnately I'm not by my COMSOL WS tonight ;) -- 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.