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.
Can't plot variables defined in terms of dependent variables
Posted Oct 7, 2012, 3:04 PM EDT 7 Replies
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?
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
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.
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
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?
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 ...
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.
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" ;)
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.