CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > COMSOL

What's wrong with COMSOL?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2022, 22:51
Default What's wrong with COMSOL?
  #1
New Member
 
Andy Sun
Join Date: Mar 2022
Posts: 6
Rep Power: 4
andy.sun.wei is on a distinguished road
I've been a COMSOL user for over 20 years (from when it was called FEMLAB). And there isn't a COMSOL user forum here at cfd-online. Is the software that unpopular?


Well, recently I ran into a COMSOL simulation problem and went to COMSOL's own forum to post and ask for user's input and help. You know what, COMSOL forum modulator deleted my post and banned my account very quickly. Wow, I'm surprised by the COMSOL treatment to their user. Maybe that's the reason nobody using it any more. By the way, that was the first time I posted anything there.



Any way, here is my COMSOL simulation problem and let me know if you can help. It's a long post, please bare with me.


All in all I got some weird results from COMSOL simulation and hope someone can explain where I got it wrong, or COMSOL is wrong?


I’m trying to study a very simple 2-gas mixing problem. I assume there is only diffusion between the gasses and ignore any convection flow or gravitational effect. The gases follow Fick’s diffusion law and diffusion coefficient is set at 1.2e-5[m^2/s].
This is a 2-D simple geometry problem, see picture 1 below. The 2 gases initially are separated in 2 adjacent boxes with gas 1 in box 1 with molar mass for gas 1Mw1=0.016[kg/mol] and gas 2 in box 2 withMw2=0.044[kg/mol]. Pressure is set at 1 [atm] and temperature at 293.15 [K] all over. The gases behavior like ideal gas.


Listed in table below are calculated volume, density, mass and molar amount (assume depth at 1 [m]) of the 2 gases. The 2 gases start to mix from complete separated state at beginning. Eventually when they are fully mixed the gas volume percentage will be 80% for gas 1 and 20% for gas 2, which is equal to the initial volume percentage of the 2 gasses. The gas mass faction will be w1= 0.5926 and w2=0.4074 everywhere when fully mixed.




Here I solve the problem as time dependent and got the solution up to 100 seconds. The 4 plots (picture 3) are for gas 1 mass faction w1 at time of 0, 1, 10 and 100 second mark. The results seem reasonable. At beginning (0 second), gas 1 is only at the left box (w1=1) and no gas 1 in right box (w1=0). As time evolve, it can be seen that the mass fraction of gas 1 gradually goes from left to right (see 1 and 10 second plots). At 100 second, the plot shows w1 is virtually uniform across all domains 1 and 2, that means 2 gases are fully mixed.



However, the results at 100 second show w1= 0.71149 all across. Or if plot the surface with gas volume concentration for gas 1 (use formula (w1/0.016)/(w1/0.16+w2/0.044) ), the result is 87.149% all across at 100 second. Those results are totally different from the theoretically calculated results. Where did I get it wrong? I’m carefully about mesh I used, please see the picture 4 below of mesh size. I think it is a good strategy to use extra fine mesh at the separate boundary between the 2 gases. Also, the separation boundary is assume to have no thickness.


The COMSOL Multiphysics module used for this problem is “Transport of Concentrated Species”.



If you want try it, you can compile this simulation in 5 minutes following the parameters shown in the pictures, COMSOL version 5 or above will do.


Thank you for reading this.

Last edited by andy.sun.wei; March 29, 2022 at 23:48. Reason: don't want to recieve answer anymore
andy.sun.wei is offline   Reply With Quote

Old   March 20, 2022, 02:41
Default
  #2
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,278
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
It is hard to say what is going on but we can try to guess based on few things.

My first guess would be lack of convergence during time step. So I would just reduce the simulation timestep by factor of 10 and run the whole thing. If the things become better I would then think what shall be causing this lack of convergence.
arjun is online now   Reply With Quote

Old   March 20, 2022, 08:38
Default
  #3
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,167
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
As per the COMSOL status on this Forum, you might want to look at this certainly biased poll that took place in 2018. 49 users answered and multiple answers were allowed. Only the 6% (3 among 49 users) use it.
sbaffini is offline   Reply With Quote

Old   March 20, 2022, 11:09
Default
  #4
New Member
 
Andy Sun
Join Date: Mar 2022
Posts: 6
Rep Power: 4
andy.sun.wei is on a distinguished road
Quote:
Originally Posted by arjun View Post
It is hard to say what is going on but we can try to guess based on few things.

My first guess would be lack of convergence during time step. So I would just reduce the simulation timestep by factor of 10 and run the whole thing. If the things become better I would then think what shall be causing this lack of convergence.

Hi, Arjun,


I think you might onto something. One thing I didn't mention in the original post is that I tried to solve the problem I described using "stationary" solver to find the steady state solution. It should come to a final stead state when fully mixed with certain gas concentration. But I found that every time I solve it, the results change. The gas 1 mass fraction changes every time, jumping from 0.67, 0.76, 0.87, 0.93 etc. It's very weird.


As to the "time dependent" solver, unfortunately it's unfortunately very stable. As you suggested, I reduced the time step from 0.1 to 0.01 second, the results are exactly the same.


I came up with this simplified gas mixing model as a sanity check. I've been doing some gas dissipation study into complex 3D geometry. Later on, I was doubting if the mass was balanced, meaning the final concentration didn't seem to add up to match the total amount of mass I put into there. That's why I did some sanity checks and came to this.



Thank you for you time.
andy.sun.wei is offline   Reply With Quote

Old   March 20, 2022, 11:11
Default
  #5
New Member
 
Andy Sun
Join Date: Mar 2022
Posts: 6
Rep Power: 4
andy.sun.wei is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
As per the COMSOL status on this Forum, you might want to look at this certainly biased poll that took place in 2018. 49 users answered and multiple answers were allowed. Only the 6% (3 among 49 users) use it.

Thank you sbaffini for the interesting poll. I know COMSOL is not a strong content as a CFD simulation tool, still it's sad to see it's so low in the ranking.
andy.sun.wei is offline   Reply With Quote

Old   March 20, 2022, 20:01
Default
  #6
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,167
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
With pure diffusion, a correct steady solver should reach the exact same solution that would eventually be reached by an unsteady solver, provided the boundary conditions allow that.

If boundary conditions don't allow that (say Neumann over all boundaries), there might be a visible effect linked to the numerical discretizazion, but for a given initialization it should be always the same.

Actually, excluding you are in certain unrealistic enviromental conditions that would affect your machine, even straightly wrong codes should still behave fully deterministically, unless explicitly instructed to not do so. So, results changing so wildly with runs suggests there might some more general issue.
sbaffini is offline   Reply With Quote

Old   March 21, 2022, 00:31
Default
  #7
New Member
 
Andy Sun
Join Date: Mar 2022
Posts: 6
Rep Power: 4
andy.sun.wei is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
With pure diffusion, a correct steady solver should reach the exact same solution that would eventually be reached by an unsteady solver, provided the boundary conditions allow that.

If boundary conditions don't allow that (say Neumann over all boundaries), there might be a visible effect linked to the numerical discretizazion, but for a given initialization it should be always the same.

Actually, excluding you are in certain unrealistic enviromental conditions that would affect your machine, even straightly wrong codes should still behave fully deterministically, unless explicitly instructed to not do so. So, results changing so wildly with runs suggests there might some more general issue.

Yes, I'm afraid I have made some general mistakes somewhere but I can't see it.

Last edited by andy.sun.wei; March 21, 2022 at 00:31. Reason: typo
andy.sun.wei is offline   Reply With Quote

Old   March 21, 2022, 23:26
Default
  #8
New Member
 
Andy Sun
Join Date: Mar 2022
Posts: 6
Rep Power: 4
andy.sun.wei is on a distinguished road
please see attached file for this problem, in version 5.5.



due to the file size limit, the mesh is cleared too, it needs to be re-built before solve.


thank you for your help!

Last edited by andy.sun.wei; March 29, 2022 at 23:12.
andy.sun.wei is offline   Reply With Quote

Old   March 23, 2022, 12:28
Default
  #9
New Member
 
Andy Sun
Join Date: Mar 2022
Posts: 6
Rep Power: 4
andy.sun.wei is on a distinguished road
Can any one give a quick test run on the uploaded program? Really frustrated about this wrong result.



Quote:
Originally Posted by andy.sun.wei View Post
please see attached file for this problem, in version 5.5.



due to the file size limit, the mesh is cleared too, it needs to be re-built before solve.


thank you for your help!
andy.sun.wei is offline   Reply With Quote

Old   March 23, 2022, 12:30
Default
  #10
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,167
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by andy.sun.wei View Post
Can any one give a quick test run on the uploaded program? Really frustrated about this wrong result.
I don't have nor I ever had COMSOL, so I can't help here
sbaffini is offline   Reply With Quote

Reply

Tags
comsol 5, transport of species

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rigid body in creeping flow - COMSOL MultiPhy CFD Freelancers 1 June 8, 2017 01:38
Something wrong running rhoSimpleFoam (urgent!) PeterShi OpenFOAM Running, Solving & CFD 7 March 1, 2017 09:21
udf error srihari FLUENT 1 October 31, 2016 14:18
fully developed channel flow with kOmega, wrong results boshynova OpenFOAM Programming & Development 1 April 20, 2016 10:54
Pros and Cons for CFX, CFdesign, COMSOL Val Main CFD Forum 3 June 10, 2011 02:20


All times are GMT -4. The time now is 14:49.