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.
File input trouble (Unknown Variable)
Posted 2016年1月26日 GMT-5 16:19 Heat Transfer & Phase Change, Materials, Parameters, Variables, & Functions Version 4.3b 8 Replies
Please login with a confirmed email address before reporting spam
Function name: Q_t
Position in File: 1
Interpolation: Nearest Neighbor
Extrapolation: Constant
Plotting this results in the same plot I'd see in Excel or MATLAB, so I'm assuming COMSOL recognizes the data. However, when I try to use "Q_t" later, it gives me a warning and "Unknown Variable Q_t." To be thorough, I have Heat Transfer > Heat Flux, where total heat flux is defined by Q_t
Please login with a confirmed email address before reporting spam
COMSOL has thousands of internal variables, if you use a few physics modules so often its quite simple to hit an already used name, and sometimes you may get trouble and strange results, without specially any warnings, because COMSOL allows you to change internal variables, therefore it could be correct that you change some internal variable, COMSOL cannot tell.
My way around is to :
a) use names with some length and/or some special termination or prefix as"my_var_"
b) check the names by defining a dummy Parameter and equate it to the name, if some values or units pop up, there is a good chance that the variable is already defined, but this last trick is not sufficient, it will only work with active variables once the model is set up and you have at least run an "get initial conditions" ideally solved the model once.
c) do the same (or ignore b and directly go to c) in the Definitions Variable, define a dummy variable and equate it to the name I want to use, again if some units pop up there is a good chance that its already defined as an internal variable. If the variable is flagged red probably its a genuine name at least until you load a new physics with more variables.
d) one must also refer to the scope of the variables, dependent variables are defined "globally" such as (u,v,w) but most physics variable are tagged with the specific physics prefix i.e. such as "solid.freq" : internal "solid" physics - eigenfrequency variable.
To get a view of the many variables under the hood, activate the equation view and study the equations therein (set in the preferences)
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
I think the problem might be that you call the interpolation function without arguments. You should call it using something like
Q_t(x,y)
depending on the number of arguments of the function and the geometry dimension.
Best regards,
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
The first 10 rows of the input file looks like this:
0.00, 0.00
3.02, 0.00
6.05, 0.00
9.07, 0.00
12.01, 0.00
15.03, 0.00
18.06, 0.00
21.08, 0.00
24.02, 0.00
27.04, 0.00
and there are about 200000 more rows (mostly zeros- this heater doesn't come on often). Or could it be that the time step isn't constant? I can't imagine it's the file itself. Like I said, COMSOL does recognize the data when I plot it.
Please login with a confirmed email address before reporting spam
That should work. Could you post a simple example file (MPH-file) and the input file? Otherwise, it's hard to say what the problem is.
Best regards,
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
could this be the same issue reported some months ago (22 oct 2015) also on the Forum, about COMSOL's way of plot resampling and loss of visual data (although if I remember all data was used internally) ?
Because there was quite some differences in peak values and visual read out of plotted values for a long input file
see
www.comsol.eu/community/forums/general/thread/93111
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Interesting model! I tested it in COMSOL Multiphysics version 5.2 (our current version), and it runs without errors. I can see now that you tagged this posting with version 4.3b. A lot has happened since that version, so I strongly recommend that you update to the latest version.
However, I also tested this model in version 4.3b, and it worked for me in that version, too.
Best regards,
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
Hi
could this be the same issue reported some months ago (22 oct 2015) also on the Forum, about COMSOL's way of plot resampling and loss of visual data (although if I remember all data was used internally) ?
Because there was quite some differences in peak values and visual read out of plotted values for a long input file
see
www.comsol.eu/community/forums/general/thread/93111
--
Good luck
Ivar
With this issue, this user was able to import the spreadsheet and use it, but she just had different results than what she expected. I am able to import the spreadsheet, but I am unable to call the function later. It's close though. It does sound like I have the same format in my spreadsheet, with one column of time, and one column of data.
Hi Ryan,
Interesting model! I tested it in COMSOL Multiphysics version 5.2 (our current version), and it runs without errors. I can see now that you tagged this posting with version 4.3b. A lot has happened since that version, so I strongly recommend that you update to the latest version.
However, I also tested this model in version 4.3b, and it worked for me in that version, too.
Best regards,
Magnus Ringh, COMSOL
Interesting. Can you walk me through what you did, if you changed anything from the file I gave you? I feel like I'm missing one tiny thing.
Please login with a confirmed email address before reporting spam
I opened the MPH-file and re-solved. I also discarded the interpolation data and reimported it from the data you sent (saved from the M-file as a plain text file) and re-solved again. I did not change any other settings. If you still cannot get it to work, I recommend that you contact your local COMSOL office for technical support.
Best regards,
Magnus Ringh, COMSOL
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.
Suggested Content
- FORUM input of a variable which is changing
- BLOG The Optimal Workflow for Complex Modeling Projects on a Deadline
- KNOWLEDGE BASE How does COMSOL Multiphysics handle complex-valued numbers and problems in the frequency domain?
- BLOG Surface, Volume, and Line Plots: Visualizing Results on a Heat Sink
- FORUM How to give a ramp input