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.

Oscillations

Please login with a confirmed email address before reporting spam

Hi All, I had a quick question,

I'm seeing oscillations emerge in my model (a 1D mass flow situation), and I was wondering: is it possible for these oscillations to emerge due to the solver (too coarse a mesh or timestep?)?

I've tried a couple meshes down to what is reasonable, and a few timesteps, so I suspect it is a result of my model itself but I wanted to check with the community just to know, if only for my own erudition, if the solver itself can induce spatial or temporal oscillations.

Thank you,

6 Replies Last Post 19 ott 2012, 09:31 GMT-4
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 18 ott 2012, 11:14 GMT-4
Hi

indeed depending on several parameters, and the model, you might get oscillations while solving.
Some might be physical in the time domain: if you have step functions that excite many modes of your system,
Other might be purely numerical from typical effects as you state: mesh density, initial conditions BC gradients all not well behaved ...

That is what model validation and verification is all about, to sort these side effects and remove them

--
Good luck
Ivar
Hi indeed depending on several parameters, and the model, you might get oscillations while solving. Some might be physical in the time domain: if you have step functions that excite many modes of your system, Other might be purely numerical from typical effects as you state: mesh density, initial conditions BC gradients all not well behaved ... That is what model validation and verification is all about, to sort these side effects and remove them -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 18 ott 2012, 11:50 GMT-4
Thanks Ivar,

I suspect that this might be part of the problem, but I want to make sure I am understanding it right:

I set my initial conditions to something (a spatial gaussian to be specific), and when I plot the variable for the initial state it looks good, but when I plot the the resulting variables at time = 0,they look different, and in fact are spatially oscillatory, which might give rise to the oscillations that follow.

Is it changing my initial condition, or is the time = 0 it is showing me really after a single timestep forward?

Thanks Ivar, I suspect that this might be part of the problem, but I want to make sure I am understanding it right: I set my initial conditions to something (a spatial gaussian to be specific), and when I plot the variable for the initial state it looks good, but when I plot the the resulting variables at time = 0,they look different, and in fact are spatially oscillatory, which might give rise to the oscillations that follow. Is it changing my initial condition, or is the time = 0 it is showing me really after a single timestep forward?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 18 ott 2012, 13:09 GMT-4
I think that I have the issue.

I have a 1D mass flow system, and I wanted the two ends of the system to be infinite sources or sinks of mass (the closest analogy is if we had a solution between two reservoirs with fixed concentration, and we were looking at the motion of salt ions in the solution under the influence of an electric field). My instinct was to fix the concentration at those two boundaries.

BUT, that's like holding down two ends of a string, since I'm really demanding that the *system* maintain that concentration, I'm not providing or sinking concentration from the outside. That gives me my oscillations.


So what *can* I use to model an infinite source or sink? I thought of using the Flux/source boundary condition as a function of the concentration, so that if the concentration deviates from the 'bath' concentration, an infinite source or sink is provided, but I don't quite understand the equation in the Flux/source BC - it seems that it is defining a gradient at the edges, but I want that gradient to depend on the concentration, which my crude attempts at have not solved the problem.
I think that I have the issue. I have a 1D mass flow system, and I wanted the two ends of the system to be infinite sources or sinks of mass (the closest analogy is if we had a solution between two reservoirs with fixed concentration, and we were looking at the motion of salt ions in the solution under the influence of an electric field). My instinct was to fix the concentration at those two boundaries. BUT, that's like holding down two ends of a string, since I'm really demanding that the *system* maintain that concentration, I'm not providing or sinking concentration from the outside. That gives me my oscillations. So what *can* I use to model an infinite source or sink? I thought of using the Flux/source boundary condition as a function of the concentration, so that if the concentration deviates from the 'bath' concentration, an infinite source or sink is provided, but I don't quite understand the equation in the Flux/source BC - it seems that it is defining a gradient at the edges, but I want that gradient to depend on the concentration, which my crude attempts at have not solved the problem.

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 18 ott 2012, 14:33 GMT-4
Hi

What about doing it the "quick" way à la "laminar inflow region" ?
You add some extra length at the input and the output, that you do not consider for your model and leave the system stabilise there.
Then something often forgotten, check your initial conditions.
Often one have very steep gradients (particularly for diffusion equations) along constant value boundaries, of flux inlet when the domain is at initial conditions = "0".
Then its useful to analyse the gradients of your dependent variables and ensure you have a fine mesh perpendicular to the flux in these regions (I often add "boundary mesh" elements). This particularly in time stepping solver cases.

Then solve, and as said before, do not consider the first entrance/exit length as part of your model for postprocessing

--
Good luck
Ivar
Hi What about doing it the "quick" way à la "laminar inflow region" ? You add some extra length at the input and the output, that you do not consider for your model and leave the system stabilise there. Then something often forgotten, check your initial conditions. Often one have very steep gradients (particularly for diffusion equations) along constant value boundaries, of flux inlet when the domain is at initial conditions = "0". Then its useful to analyse the gradients of your dependent variables and ensure you have a fine mesh perpendicular to the flux in these regions (I often add "boundary mesh" elements). This particularly in time stepping solver cases. Then solve, and as said before, do not consider the first entrance/exit length as part of your model for postprocessing -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19 ott 2012, 09:12 GMT-4
I think I see, so instead of fixing the boundary at a value which will pin the differential equations at that boundary giving me harmonic oscillations, provide regions at the ends where the PDEs do not hold but I set the 'concentration' to be constant, so my gradient at those boundaries will always 'supply' or 'sink' concentration at the region of interest.

I'll give that a try, and for the BC for my PDEs I'll enforce continuity at the boundaries?

As for the IC yeah I checked that and those are right and appear stable.

I'll also try to make the mesh denser near the boundary.
I think I see, so instead of fixing the boundary at a value which will pin the differential equations at that boundary giving me harmonic oscillations, provide regions at the ends where the PDEs do not hold but I set the 'concentration' to be constant, so my gradient at those boundaries will always 'supply' or 'sink' concentration at the region of interest. I'll give that a try, and for the BC for my PDEs I'll enforce continuity at the boundaries? As for the IC yeah I checked that and those are right and appear stable. I'll also try to make the mesh denser near the boundary.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19 ott 2012, 09:31 GMT-4
So this is a novice question, but to make this happen I need to provide different values for variables in different intervals. Sticking with the concentration analogy, I need my PDEs to apply in the central regions, but I need the variable value fixed in the baths.

What is the most appropriate way to do that? I could provide an inequality in my PDE equations (dC/dt = 0 when x is in the bath region), but I'm wondering if there is a better way of doing it?


Also, I am using Identity pairs and enforcing continuity as a BC to couple my costant-concentration baths to the region of interest at the ends, hopefully that is the appropriate approach.
So this is a novice question, but to make this happen I need to provide different values for variables in different intervals. Sticking with the concentration analogy, I need my PDEs to apply in the central regions, but I need the variable value fixed in the baths. What is the most appropriate way to do that? I could provide an inequality in my PDE equations (dC/dt = 0 when x is in the bath region), but I'm wondering if there is a better way of doing it? Also, I am using Identity pairs and enforcing continuity as a BC to couple my costant-concentration baths to the region of interest at the ends, hopefully that is the appropriate approach.

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.