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.
Defining a variable....
Posted 19 mag 2015, 03:04 GMT-4 Version 4.4 6 Replies
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
I'm not sure what you want to do, but I can see a couple of issues here:
- Using a step size of 0 is not allowed. You should use a nonzero step size for the range function.
- For a variable defined under Variables, you can define an expression in a flexible way, but it must represent a scalar-valued function (that is, when called with its inputs, it returns a scalar value). You can define a variable as
2*pi*r^2
in an axisymmetric model where r is a spatial coordinate, for example.
The range function returns a list (vector) of values, and it is therefore not applicable in the Variables definitions, so it should not work in any of the cases you describe. It is useful where you specify lists of values: In the Times field for the output times from a time-dependent study, for example.
Best regards,
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
Please login with a confirmed email address before reporting spam
One way I like evaluating my ranges is using normalized ranges, for example:
5 + 7 * range(0, 0.01, 1)
is a range from 5 to 12 with 101 points.
A nice thing about doing a 0 to 1 range is it's easy to modify the progression. For example, if I want to slowly increase the step size I can do:
5 + 7 * range(0, 0.01, 1)^2
Then I get small steps at the beginning but larger steps at the end but I don't need to do any math to figure out how to adjust the function.
Please login with a confirmed email address before reporting spam
I am working on the fault diagnosis of the grounding grid. For the diagnosis I am using electromagnetic Induction Method. As I inject the current, the magnetic flux density that is produced is to be measured. Now I want to put the formula for magnetic flux density B that is through Biot Savat law.
The case I am working on is a conductor of length 1m lying at 45 degrees with the x-axis. When current I flows in the conductor the magnetic flux density produced at point (x0,y0,z0) will be...
B=uI/(4pi)*[cos(45)*integrate((y0-a)/r^3,a,0,cos(45))-sin(45)*integrate((x0-a)/r^3,a,0,sin(45))].
where r is the position vector from the differential element on the conductor to the point of measurement(x0,y0,z0). r=sqrt((xo-a)^2+(y0-a)^2+(z0-0)^). where (a,a,0) is the position of differential elements.
where a ranges from 0 to 0.707. Now I want to define this 'a' in my variables(local) because it takes range of values. How can we define? I defined the 'B' in my variables as well.
Please login with a confirmed email address before reporting spam
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.
