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.

Define a selection from the solution

Please login with a confirmed email address before reporting spam

Hi,

I am solving a two-phase system and I want to know, how can I calculate the time-dependent rise velocity of the bubble (in the file below)? In my case the domain selection is not possible because the solution is non-stationary.

Thank you very much in advance for your answer,

Regards
Fjodor


18 Replies Last Post 5 nov 2012, 08:25 GMT-5
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 ott 2012, 04:04 GMT-4
Hi

nice bubble ;) by the way you can make the border more precise if you reduce the color domain to i.e. 0.4-0.6

Whell how do you define the buble position, since it's even changing shape ?
perhaps it's centre of gravity ?

Well as you have a variable>0.5 to define the buble, you could try to integrate the full volme, times the density, times (x,y,z), times the "(buble definition variable >0.5)" and divide by the buble volume, or simething like that, no ?

Then to get it's velocity, make a global expression with a variable to equate this integrated value, then COMSOL will generate the time derivatives for you.

--
Good luck
Ivar
Hi nice bubble ;) by the way you can make the border more precise if you reduce the color domain to i.e. 0.4-0.6 Whell how do you define the buble position, since it's even changing shape ? perhaps it's centre of gravity ? Well as you have a variable>0.5 to define the buble, you could try to integrate the full volme, times the density, times (x,y,z), times the "(buble definition variable >0.5)" and divide by the buble volume, or simething like that, no ? Then to get it's velocity, make a global expression with a variable to equate this integrated value, then COMSOL will generate the time derivatives for you. -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 ott 2012, 05:30 GMT-4
Thank You, Ivar.

Yes, I need the volume of the bubble for calculating the (average) velocity. In the bubble the phase-field variable phi <0.
How can I define a global expression for the velocity depending on phase-field variable? Or how can I calculate the volume of the bubble?

v(phi<0)

In the COMSOL I can only select a surface (domain) and the expression like velocity or phase-field variable but I can not select the domain, where phi<0.

Thank you very much in advance for your answer,

Regards
Fjodor
Thank You, Ivar. Yes, I need the volume of the bubble for calculating the (average) velocity. In the bubble the phase-field variable phi


Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 ott 2012, 08:11 GMT-4
Hi

You can define an integration operator intop1() as Definition Operator integration, and select your full domain
Thendefine a local variable Definition - Variable Xg = intop1(Xg*(phi>0.1))/intop1(1) and so on.

If you have a variation in density you might want to consider this too.

Then one can pastprocess the Xg variable to get the time derivative, from a time stepping case (not sure it was all there in 4.2, exist in 4.3a)

--
Good luck
Ivar
Hi You can define an integration operator intop1() as Definition Operator integration, and select your full domain Thendefine a local variable Definition - Variable Xg = intop1(Xg*(phi>0.1))/intop1(1) and so on. If you have a variation in density you might want to consider this too. Then one can pastprocess the Xg variable to get the time derivative, from a time stepping case (not sure it was all there in 4.2, exist in 4.3a) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 28 ott 2012, 09:54 GMT-4
Ivar, thank you very much for the answer. Now I can calculate the expressions.
Ivar, thank you very much for the answer. Now I can calculate the expressions.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 29 ott 2012, 09:49 GMT-4
Hello Ivar,

I also need the perimeter of the elliptical bubble (Line Integration about the contour with phi=0). Is it possible to capture this contour or to calculate the perimeter of the bubble?

Thank you very much in advance for your answer,

Regards
Fjodor
Hello Ivar, I also need the perimeter of the elliptical bubble (Line Integration about the contour with phi=0). Is it possible to capture this contour or to calculate the perimeter of the bubble? Thank you very much in advance for your answer, Regards Fjodor


Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 30 ott 2012, 05:30 GMT-4
Hi

that is a trickier one, but there must be a solution,

I do not know the solution just like that, but someone else must have done or asked for that already,

!! nobody else out here to give us a suggestion ? :)

by the way I believe it's rather the contour at phase / level set phi=0.5

--
Good luck
Ivar
Hi that is a trickier one, but there must be a solution, I do not know the solution just like that, but someone else must have done or asked for that already, !! nobody else out here to give us a suggestion ? :) by the way I believe it's rather the contour at phase / level set phi=0.5 -- Good luck Ivar

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 30 ott 2012, 05:59 GMT-4
Hi again

One way, to get an approximation:

Would be to integrate the volume of (phi>0.45)*(phi<0.55) and divide the result by the width (0.55-0.45)=0.1, assuming phi is rather linear. Or to estimate the true average width via the spatial derivative of phi around phi = 0.5

You could try a smaller intervall, but at some stage you need also to have several mesh elements within this Volume/area intervalle to get a reasonable precision

But why didnt you think of this solution, it's rather obvios no ? ;)

But there must be a more precise method too

--
Good luck
Ivar
Hi again One way, to get an approximation: Would be to integrate the volume of (phi>0.45)*(phi

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 30 ott 2012, 06:14 GMT-4
Hello Ivar,

Thank you for the answer.
Yes, I already tried this approximation but I need a more precise solution. I will work on it.

Regards
Fjodor
Hello Ivar, Thank you for the answer. Yes, I already tried this approximation but I need a more precise solution. I will work on it. Regards Fjodor

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 30 ott 2012, 06:55 GMT-4
Hi

and did it work out, or was it not precise enough ?

--
Good luck
Ivar
Hi and did it work out, or was it not precise enough ? -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 30 ott 2012, 08:09 GMT-4
It works but it is not precise enough :)
It works but it is not precise enough :)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 nov 2012, 05:38 GMT-4
Hello Ivar,

I know how one can calculate the circumference. I added to data sets (results) a contour of phi=0. Then I did a line integration over this contour. But there is a small inconvenience, one have to select the time manually. Ivar, what would you say?

Best regards
Fjodor
Hello Ivar, I know how one can calculate the circumference. I added to data sets (results) a contour of phi=0. Then I did a line integration over this contour. But there is a small inconvenience, one have to select the time manually. Ivar, what would you say? Best regards Fjodor

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 nov 2012, 06:02 GMT-4
Hi

indeed, a good idea, provided your mesh is fine enough, it should be more precise than my integration way

--
Good luck
Ivar
Hi indeed, a good idea, provided your mesh is fine enough, it should be more precise than my integration way -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 nov 2012, 08:43 GMT-4
Hi,

What about a "simple" Model Coupling > Integration > boundaries of your bubble, let it be intop1(). And then you'll have access at every time to the perimeter, as intop1(1), or else at a certain time instant as at(tinst, intop1(1)), where 'tinst' is the time instant for which you want to "measure" the perimeter.

Jesus.
Hi, What about a "simple" Model Coupling > Integration > boundaries of your bubble, let it be intop1(). And then you'll have access at every time to the perimeter, as intop1(1), or else at a certain time instant as at(tinst, intop1(1)), where 'tinst' is the time instant for which you want to "measure" the perimeter. Jesus.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 nov 2012, 12:09 GMT-4
Hi Jesus

You should check first how level set or the phase method works, there is no geoemtrical boundary, its dfefine by a variable field, the boundary is when this field croosses a given value, hence one must creta a boundary, and by using a contour formulation we can get a Data Set "edge" to integrate around

--
Good luck
Ivar
Hi Jesus You should check first how level set or the phase method works, there is no geoemtrical boundary, its dfefine by a variable field, the boundary is when this field croosses a given value, hence one must creta a boundary, and by using a contour formulation we can get a Data Set "edge" to integrate around -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 3 nov 2012, 09:38 GMT-4
Hello, Ivar and Fjodor:

Thanks, Ivar, for the clear rectification. I have been thinking on the problem, and I remembered Green's theorem. Instead of looking for the boundary (which really doesn't exist as such), we can do a surface integration (which is well defined). As Fjodor says, in the bubble phi < 0. Thus, I propose the following:

1. Let's define a vector field, n, such that a unit vector normal to the phi surface is assigned to every point in the plane xy. For instance, n = grad(phi)/norm[grad(phi)].
In COMSOL's notation (let p be phi):
nX = px/M and nY = py/M,
where: M is the norm of the gradient of phi:
M = sqrt(px^2 + py^2).
Note that with a final X I mean the x-coordinate, and with a final x I mean (as COMSOL) the partial derivative w.r.t. x

2. Let's define another vector field, t, normal to n, for instance:
tX = -nY and tY = nX

3. Now, according to Green's theorem, the length of the perimeter of the bubble, i.e. the curve integral of the vector field t along the bubble's perimeter, is equal to the surface integral of
Z = tYx - tXy
on all the bubble surface. This integral can be done by integrating Z*(phi < 0) on all the domain.

4. After some algebra ( `;-( ) I have obtained this expresion for Z:
Z = (pxx*py^2 + pyy*px^2 - 2*px*py*pxy)/M^3

5. Apart from the above considerations, care must be taken with the case M = 0, in which case Z should be defined 0. Thus, the integration on the whole domain could be of the quantity:
Z * (p < 0) * (abs(M) > 1e-3) ,
in order to restrict the integration to the bubble and only to regions where the gradient of phi is not excessively low (of course, the value 1e-3 should be adjusted). The last condition (logical factor) is because regions with phi "too constant" could give too low values of M and then "too divergent" values of Z.

6. Of course, all previous points can be defined as variables, and the integral done as a Model Coupling, so that the value of the perimeter is available during simulation at any time.

I hope someone uses this (and it works).

Jesus.


Hello, Ivar and Fjodor: Thanks, Ivar, for the clear rectification. I have been thinking on the problem, and I remembered Green's theorem. Instead of looking for the boundary (which really doesn't exist as such), we can do a surface integration (which is well defined). As Fjodor says, in the bubble phi < 0. Thus, I propose the following: 1. Let's define a vector field, n, such that a unit vector normal to the phi surface is assigned to every point in the plane xy. For instance, n = grad(phi)/norm[grad(phi)]. In COMSOL's notation (let p be phi): nX = px/M and nY = py/M, where: M is the norm of the gradient of phi: M = sqrt(px^2 + py^2). Note that with a final X I mean the x-coordinate, and with a final x I mean (as COMSOL) the partial derivative w.r.t. x 2. Let's define another vector field, t, normal to n, for instance: tX = -nY and tY = nX 3. Now, according to Green's theorem, the length of the perimeter of the bubble, i.e. the curve integral of the vector field t along the bubble's perimeter, is equal to the surface integral of Z = tYx - tXy on all the bubble surface. This integral can be done by integrating Z*(phi < 0) on all the domain. 4. After some algebra ( `;-( ) I have obtained this expresion for Z: Z = (pxx*py^2 + pyy*px^2 - 2*px*py*pxy)/M^3 5. Apart from the above considerations, care must be taken with the case M = 0, in which case Z should be defined 0. Thus, the integration on the whole domain could be of the quantity: Z * (p < 0) * (abs(M) > 1e-3) , in order to restrict the integration to the bubble and only to regions where the gradient of phi is not excessively low (of course, the value 1e-3 should be adjusted). The last condition (logical factor) is because regions with phi "too constant" could give too low values of M and then "too divergent" values of Z. 6. Of course, all previous points can be defined as variables, and the integral done as a Model Coupling, so that the value of the perimeter is available during simulation at any time. I hope someone uses this (and it works). Jesus.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 4 nov 2012, 11:45 GMT-5
Hi
Indeed that looks interesting, and rather obvious (once you read it)
But you should ensire that the 2nd derivative (spatial) of phi are really continuous, hence increase the order of the phi variable discretization to at least third order, and to ensure a fine mesh all along the region where the "virtual" boundary is appearing.

One would need to test a little to see which of the two methods are the most precise, and cheapest w.r.t. mesh and DoF's, but yours should be compatible for te solving, while the data set analysis contour plot approach is clearly a Postprocessing only way

--
Good luck
Ivar
Hi Indeed that looks interesting, and rather obvious (once you read it) But you should ensire that the 2nd derivative (spatial) of phi are really continuous, hence increase the order of the phi variable discretization to at least third order, and to ensure a fine mesh all along the region where the "virtual" boundary is appearing. One would need to test a little to see which of the two methods are the most precise, and cheapest w.r.t. mesh and DoF's, but yours should be compatible for te solving, while the data set analysis contour plot approach is clearly a Postprocessing only way -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 nov 2012, 04:27 GMT-5
Hello Jesus,

thank you for the suggestion.
I tried to calculate the circumference with Green's theorem (Z*(phi < 0)).
It works but it is not precise enough. Probably because the phase-field variable phi is only a function of X and Y at the interface, i.e. in a small region. Otherwise in the bubble is phi=-1 (constant).

Regards
Fjodor
Hello Jesus, thank you for the suggestion. I tried to calculate the circumference with Green's theorem (Z*(phi < 0)). It works but it is not precise enough. Probably because the phase-field variable phi is only a function of X and Y at the interface, i.e. in a small region. Otherwise in the bubble is phi=-1 (constant). Regards Fjodor

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 nov 2012, 08:25 GMT-5
Hi

I though it was phi<0.5 and not "0" for the limt, or am I mising something ?

--
Good luck
Ivar
Hi I though it was phi

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.