Can't plot variables defined in terms of dependent variables

Topics: no topics

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   7 Replies   Last post: October 8, 2012 8:29pm UTC
Randy Johnston

Randy Johnston

October 7, 2012 7:04pm UTC

Can't plot variables defined in terms of dependent variables

I am having a problem with plotting for my simple laminar flow model. I can plot in terms of the simulation's dependent variables, but not in terms of variables that are defined in terms of the dependent variables.

In other words, in my model (attached), I can plot "-u*mu/(A*H^2)", but not "vbar_mod", which is defined exactly as "-u*mu/(A*H^2)".

Why is this happening?

Thanks!

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg

October 7, 2012 9:00pm UTC in response to Randy Johnston

Re: Can't plot variables defined in terms of dependent variables

Hi

you are missing one important thing, "u" is not a global variable but a field its u(x,y,z,t), so your Global definition of vbar_mod is not correct

your cut line defines a trajectory trough your domain, hence defines an x,y, so as this is slelected the local value of "u" can be found (as z=0 and t=0 for 2D stationary cases)

What you can do is to define a Model - Definitions - Variables node and copy the vbar_mod therein and remove it from the global variable list. This makes a local variable, in fact a local field as u is a field, defined over all your domains

Take care: as in COMSOL there are many places where the variables are in fact fields over (x,y,z,t) but this is implicit and not written ut fully

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jesus Lucio

Jesus Lucio

October 7, 2012 9:07pm UTC in response to Randy Johnston

Re: Can't plot variables defined in terms of dependent variables

Hello,

Define your variable vbar_mod in Model/Definitions/Variables, not in Global Definitions/Variables. This way, you can refer to variable u simply with that name: "u". Nevertheless, you can still define vbar_mod in Global Definitions/Variables, but in that case u must be referred to as "mod1.u", or something like that.

Bye,

Jesus.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg

October 8, 2012 5:50am UTC in response to Jesus Lucio

Re: Can't plot variables defined in terms of dependent variables

Hi

I believe you must define it as int1(u)* ... as a strict Global variable, as for me a Global variable is not depending on the spatial variables (x,y,z) but might be dependent on others like the time. This because x,y,z is "Model.Geometry" dependent
--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jesus Lucio

Jesus Lucio

October 8, 2012 8:49am UTC in response to Ivar Kjelberg

Re: Can't plot variables defined in terms of dependent variables

Hi, Ivar and Randy,

I meant that if you want to define "vbar_mod" as a global variable (in "Global Definitions"), the variable "u", which is associated to model 1, should be referred to as "mod1.u", and the expression should be in this case "-mod1.u*mu/(A*H^2)".

Ivar, I don't understand the int operator. Do you refer to an integration?

Bye,

Jesus.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg

October 8, 2012 9:56am UTC in response to Jesus Lucio

Re: Can't plot variables defined in terms of dependent variables

Hi Jesus

You are right, interesting ...,
it could come from something not working 100% in the early v4 version and that I had integrated as a "rule".

By adding "mod1.u" indeed you define a variable under Global Definitions that is not flagged "orange" and that can be called correctly in a plot file when referring to a valid (x,y) domain/boundary.

But still it's not a "Global Variable" in my understanding (as used under Results Derived Values Global Evaluation)
for me a "Global variable" is a synonym to a variable made independent to the spatial coordinates, by a pre integration over a domain or a boundary.

So it's a question of definitions and sometimes COMSOL is neither not 100% coherent within the GUI and their doc, and we users get also confused ;) (like Objects and Entities ...)

Again it tells us to reread carefully the doc at each release, new effects come and go ...

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jesus Lucio

Jesus Lucio

October 8, 2012 2:16pm UTC in response to Ivar Kjelberg

Re: Can't plot variables defined in terms of dependent variables

Hi, Ivar and all:

I was a bit confused too, about the "global" scope of variables. It seems that prior to COMSOL v.4 "global" meant non-adscribed particularly to any geometrical level (subdomain, boundary, or whatever): that variable was visible everywhere in the model. And, apparently, since version 4 the previous concept is called "nonlocal" (a nonlocal variable ---defined in "Model"/"Definitions"/"Vbles."--- is visible at all geometric levels, but only inside its model), and a variable visible to all models (and all geometries), defined at "Global definitions"/"Vbles.", is called "global". I have interpreted the matter that way.

I would thank the COMSOL team (those in charge of documentation) to mark the new items and concepts someway. For instance, in Mathematica documentation they mark the new functionalities as "new in Mathematica x", where x is the version it appeared first.

Bye,

Jesus.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg

October 8, 2012 8:29pm UTC in response to Jesus Lucio

Re: Can't plot variables defined in terms of dependent variables

Hi

they have partially done it I believe bot not systematically, on the other hand with the x thousend pages of doc from the many modules I have the reading would probably become more difficult.
You will find also many places info about backward compatibility.Not to forget the release notes
These are nice to understand the evolution, but I end up to redo all my models for each new version (or finish the model in the "older one" ;)

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines