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.

How to define divergence in COMSOL 5.5?

Please login with a confirmed email address before reporting spam

Hello

I'm using PDE to study a fluid flow problem. My vector field is called u (defined by default). Velocity field components are called u and v ('cause 2D). At some point I want to add an equation including divergence of my vector field. So, I've already tried:
* divu
* ux +vy
* d(u,x) + d(v,y)
When running simulation, same error always shows up: Failed to evaluate variable v or Undefined variable vy.

Does someone have an idea why it is happening?

Thanks in advance, Jhoan


1 Reply Last Post 06/03/2020, 15:52 GMT-5
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 12 months ago 06/03/2020, 15:52 GMT-5
Updated: 12 months ago 10/03/2020, 13:51 GMT-4

Hello Jhoan,

I am assuming that you are using the Coefficient Form physics interface. If so, by default, the dependent variable is scalar (the "Number of dependent variables" is by default set to 1), and called u, so there is no v and you would get the error message you mentioned above. If you override the default and specify a "Number of dependent variables" of 2, then by default the dependent variables will be called u1 and u2, not u and v, and again you would get the error message you mention above. You can override those default names and specify u and v as the dependent variable names. If you do, then u and v will be available to you throughout the model, and therefore quantities like vy won't be an issue - unless your model is actually 2D axisymmetric in which case the coordinates are r and z, not x and y...

If the explanation above does not clear things up, please post your mph file in this thread. It'll be easier to help you without having to engage in a guessing game.

Best,

Jeff

-------------------
Jeff Hiller
Hello Jhoan, I am assuming that you are using the Coefficient Form physics interface. If so, by default, the dependent variable is scalar (the "Number of dependent variables" is by default set to 1), and called u, so there is no v and you would get the error message you mentioned above. If you override the default and specify a "Number of dependent variables" of 2, then by default the dependent variables will be called u1 and u2, not u and v, and again you would get the error message you mention above. You can override those default names and specify u and v as the dependent variable names. If you do, then u and v will be available to you throughout the model, and therefore quantities like vy won't be an issue - unless your model is actually 2D axisymmetric in which case the coordinates are r and z, not x and y... If the explanation above does not clear things up, please post your mph file in this thread. It'll be easier to help you without having to engage in a guessing game. Best, Jeff

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.