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.
Integration coupling - how to use in function
Posted 2010年10月7日 GMT+8 00:59 7 Replies
Please login with a confirmed email address before reporting spam
Fx(x0,y0) which evaluates to
Fx(x0,y0)=\int_domain c*((x-x0)^2+(y-y0) ^2 ...
where "c" is concentration of specie in diffusion model.
1. I created integral coupling named "integral" (which will evaluate integral - I hope)
2. Then I declared in definitions analytical function Fx of parameters x0,y0
evaluating to
integral(c*((x-x0)^2+(y-y0) ^2)
which calculate integral of dependent field "c".
3. Then in model I used Fx(x,y).
But when I tried to solve model, I obtained error
Undefined variable
- Variable: c
- Function name: Fx
I tried to use mod1.chds.c instead c but it does not solve my problem.
Is there any way to calculate this integral and use it in function?
Jakub
Please login with a confirmed email address before reporting spam
from what I understand your issue is that the "c" variable seems not to be defined where you evaluate the integral.
First you must check where the c is defined (domain/boundary ...), then where the integral is performed, global or on a domain or a boundary ... and do both match ? (if not you have it wrong)
To find all the internal variables of COMSOL it's slightly cumbersome, you must read through quite some unsorted lists (turn on the preferences equtions to see them in the sub-nodes).
Furthermore, as you tried, you must use the full name, if called from outside of its local physics or node level
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Maybe you can extrude the concentration [c] into a higher geomtry dimension, then projection integrated into the present subdomain by your function.
Please login with a confirmed email address before reporting spam
integration1 (Integral) is defined on domain (second picture).
function Fx is used in domain weak contribution (third picture).
So I think all should be OK, but it does not work.
I also attached model if it can help. I am using Solver3 (stationary). Model is developed so there is a lot of unused variables etc.
Jakub
Please login with a confirmed email address before reporting spam
The integration variables are scalar variables in COMSOL Multiphysics. That's why you get the error message.
I do not understand how it relate with error, I am trying to integrate scalar values.
Maybe you can extrude the concentration [c] into a higher geomtry dimension, then projection integrated into the present subdomain by your function.
Do You mean extrude to 3D and then integrate in one dimension using projection coupling back to 2D? But I need every point of domain to be my x0,y0 reference point and I do not know how to distinguish x,y and x0,y0 in projection integral.
Can you give me an example?
Please login with a confirmed email address before reporting spam
The integration variables are scalar variables in COMSOL Multiphysics. That's why you get the error message.
I do not understand how it relate with error, I am trying to integrate scalar values.
If you mean that integral is scalar and force should be vector, I divided force to x and y component so Fx is x component and it is scalar
Please login with a confirmed email address before reporting spam
The expression that you have defined is perfectly valid in the physics settings of a model, so you should use it directly in an edit field for a force component, for example.
Analytic functions do not recognize any other arguments than the ones that you define in their Settings windows and any global parameters that you have defined. That is why you get errors when using dependent variables and integration operators, for example, in an analytic function definition.
Magnus Ringh, COMSOL
Please login with a confirmed email address before reporting spam
The expression that you have defined is perfectly valid in the physics settings of a model, so you should use it directly in an edit field for a force component, for example.
But x0 and y0 in function are coordinates of point at which I want to calculate force. If I specify expression
integral(c*((x-x0)^2+(y-y0) ^2)
in the weak expression instead using function how to specify that x0,y0 are at point where COMSOL should evaluate expression (I suppose it is sequentially each mesh point) and x,y in expression are varying in integral evaluation through whole domain.
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 Integration Coupling Variables
- FORUM use of integration
- BLOG Overview of Integration Methods in Space and Time
- KNOWLEDGE BASE Reverse Proxy Setup for Model Manager Server
- KNOWLEDGE BASE Computing Time and Space Integrals
