CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   parasitic currents (https://www.cfd-online.com/Forums/openfoam-programming-development/69673-parasitic-currents.html)

Andrea_85 June 12, 2012 06:05

Hi anton,
i think i do not understand well your first question. what do you mean with "start filtering"?. I would first define

grad(pc)-(grad(pc) dot ns)ns

at the cell centers, then i would interpolate it to face centers and dot product with "nf". We get a surfaceScalarField define at the face centers that can be multiplied with Cfc (which is a constant) and deltasf/(mag(deltasf+eps)) which is also a surfaceScalarField. Once fcf_filtered is calculated, fcf can be updated using (21).
I would put the filtering just after the capillary pressure equation in interFoamSSF.C

I think eps is used just to avoid division by zero. I would put some small numbers such as 1e-6/1e-8.

Since neither fcf nor grad(pc) change in PISO loop i would put the filtering of capillary fluxes just before UEqn.H and just after the previous filtering. I would define the total capillary flux phi_c as it is defined in pag.9, then i would apply the filtering and i would use directly phi_c in Ueqn.H and pEqn.H, instead of using fcf and grad(pc) separeted.

i am very sorry but i am preparing for a conference and i have no time to put my hands in the code now. i'll be back in 2 weeks


best

andrea

akidess June 12, 2012 06:49

Quote:

Originally Posted by Andrea_85 (Post 365978)
[...] and deltasf/(mag(deltasf+eps)) which is also a surfaceScalarField. Once fcf_filtered is calculated, fcf can be updated using (21).

In my opinion this term is problematic, because it can lead to filtering normal to the interface if the curvature is small, see my previous post.

Quote:

Originally Posted by Andrea_85 (Post 365978)
I think eps is used just to avoid division by zero. I would put some small numbers such as 1e-6/1e-8.

Indeed, it's function is to avoid div0, but it's value is not unimportant in my opinion. In the end we compute "fcf = fcf - filter", and filter will get very large if deltasf is zero (because then we have 1/eps)! For now I've also opted for 1e-6 though.

Quote:

Originally Posted by Andrea_85 (Post 365978)
i am very sorry but i am preparing for a conference and i have no time to put my hands in the code now. i'll be back in 2 weeks

No worries, I'm grateful for the input you've provided. Enjoy the conference!

- Anton

P.S. I'll post some code later today.

akidess June 12, 2012 07:11

Filtering code is now online: http://code.google.com/r/akidess-interfoamfsf/

akidess June 13, 2012 03:20

Results on the moving droplet case with filtering improved, but are nowhere as good as the reference :/

Andrea_85 June 13, 2012 06:13

just a small comment, at pag.9 they say that fcf_average is the average of capillary forces over all faces where they are non-zero. Does cmptAv account for that?

best

andrea

akidess June 13, 2012 09:10

I believe so. Btw, using the filtering algorithm as published on the repo, even the static droplet testcase doesn't work any more. After deactivating the filtering of fcf (but keeping it on phic) the static droplet case works again, so there's a problem with the computation of fcf_filter.

mksingh August 1, 2012 10:51

InterFoam: parasitic currents
 
4 Attachment(s)
Dear Anton and Andrea,
Very nice discussion about parasitic currents. I am wondering if all the issues have been solved regarding spurious velocities at interfaces in interFoam. I am using OpenFoam 2.1.x to solve a 2-D ladle draining from the bottom (water +air system). The initial condition is shown in Figure attached (t=0 s). I am getting very strange results, please see the attached pictures for t=100,120, 170 s. As you can see that after certain time (t>100s) the liquid level remains constatnt and a strange waves are appearing at the inteface. I am doubting that is it effect of spurious velocities generated at intefcae? My boundary conditions are as follows:
=====================================
Valid fields:
volVectorField U
volScalarField p_rgh
volScalarField alpha1

patch: SENOUTLET
scalar p_rgh totalPressure
scalar alpha1 inletOutlet
vector U pressureInletOutletVelocity

wall: SENWALL
scalar p_rgh buoyantPressure
scalar alpha1 zeroGradient
vector U fixedValue

empty: SYM4
scalar p_rgh empty
scalar alpha1 empty
vector U empty

empty: SYM3
scalar p_rgh empty
scalar alpha1 empty
vector U empty

empty: SYM2
scalar p_rgh empty
scalar alpha1 empty
vector U empty

empty: SYM1
scalar p_rgh empty
scalar alpha1 empty
vector U empty

patch: TW
scalar p_rgh totalPressure
scalar alpha1 inletOutlet
vector U pressureInletOutletVelocity

wall: BW
scalar p_rgh buoyantPressure
scalar alpha1 zeroGradient
vector U fixedValue

wall: SW
scalar p_rgh buoyantPressure
scalar alpha1 zeroGradient
vector U fixedValue

======================================
Any suggestion in this regard? As suggested on forum, Now I have changed cAlpha=1 to see the effect of this on my result.
Thanks in advance.
M K Singh

aliqasemi August 1, 2012 17:53

Dear Singh,

I was also used to get some non-physical velocities near the wall boundaries, much higher than the usual spurious velocities. You can call them whatever you like!
No, I think the filtering stuff are not still implemented in the interFoam code shipped with official openfoam, but you can check the links above. By the way, I am also going to release my code with a tutorial case as soon I find the time to clean it up, maybe in a few months time.

Bests, Ali

eelcovv August 3, 2012 04:38

Hi Ali

I just saw the paper of yours in J Comp Physics on this solver. Very nice work! Would be great if you would make your code public, I am sure a lot of us would like to use it. Are you going to post it on the forum? Would a 'pre-release' be possible?

Regards
Eelco

mksingh August 3, 2012 06:09

Solution of my problem (emptying ladle)
 
5 Attachment(s)
Quote:

Originally Posted by mksingh (Post 374853)
Dear Anton and Andrea,
Very nice discussion about parasitic currents. I am wondering if all the issues have been solved regarding spurious velocities at interfaces in interFoam. I am using OpenFoam 2.1.x to solve a 2-D ladle draining from the bottom (water +air system). The initial condition is shown in Figure attached (t=0 s). I am getting very strange results, please see the attached pictures for t=100,120, 170 s. As you can see that after certain time (t>100s) the liquid level remains constatnt and a strange waves are appearing at the inteface. I am doubting that is it effect of spurious velocities generated at intefcae? My boundary conditions are as follows:
=====================================
Valid fields:
volVectorField U
volScalarField p_rgh
volScalarField alpha1

patch: SENOUTLET
scalar p_rgh totalPressure
scalar alpha1 inletOutlet
vector U pressureInletOutletVelocity

wall: SENWALL
scalar p_rgh buoyantPressure
scalar alpha1 zeroGradient
vector U fixedValue

empty: SYM4
scalar p_rgh empty
scalar alpha1 empty
vector U empty

empty: SYM3
scalar p_rgh empty
scalar alpha1 empty
vector U empty

empty: SYM2
scalar p_rgh empty
scalar alpha1 empty
vector U empty

empty: SYM1
scalar p_rgh empty
scalar alpha1 empty
vector U empty

patch: TW
scalar p_rgh totalPressure
scalar alpha1 inletOutlet
vector U pressureInletOutletVelocity

wall: BW
scalar p_rgh buoyantPressure
scalar alpha1 zeroGradient
vector U fixedValue

wall: SW
scalar p_rgh buoyantPressure
scalar alpha1 zeroGradient
vector U fixedValue

======================================
Any suggestion in this regard? As suggested on forum, Now I have changed cAlpha=1 to see the effect of this on my result.
Thanks in advance.
M K Singh

=================
I have found solution to my problem why my interface was getting stagnant at certain point. After analysing my simulation, I realized that my inteface was getting stagnant exactly at zero position (y=0, vertical direction, note my middle of domian is at (0,0,0)), see picture for t=10, 50,90 s. My guess is that during presure (rho*g*h) caluculation as interface reaches at y=0 the pressure is becoming zero which is leading to stagnant inteface!! However, this needs more explaination, may be some numerical experts can provide better argument.
To solve the issue, I transformed my domain so that y=0 lies outside the domain, basically my all the domain lies in positive quadrant. This strategy has solved my problem, see attached pictures for t=10,60 s.
If someone has more input in this regard, please share.
Thanks.
M K Singh
PS: note that ladle_translation is picture where domain has been translated

Andrea_85 February 20, 2013 05:03

Hi interFoamers,

Someone has advanced with the implementation of interFoamSSF? I finally have some time to spend on it but i'm still confused about filtering stuff.

best

andrea

akidess May 16, 2013 03:02

Ali Raeini has released some code now: http://www.cfd-online.com/Forums/ope...tml#post427813

Christoph_G January 7, 2015 15:45

parasitic velocities in capillary flow
 
2 Attachment(s)
Hi,
I'm trying to simulate a capillary two-phase flow (water/Oil), where small droplets pass a junction with a sudden expansion (see first picture). U =0.05m/s, tube diameter = 0.5mm.
My original-settings are the same as in the dam-break tutorial and I'm still using interfoam.
Everything is Ok, until the droplets reach the expansion-zone. Then large Courant numbers occur in combination with high velocities at the interface of the first droplet (see red dot at picture 2).
In my opinion the complete case is only almost stable (it's a very fragile equilibrium) an when the flow becomes a little more unstable due to its deceleration spurious currents occur.
To resolve the situation I tried the following things (everything without success):
reduce courant No.
set cAlpha to 0
use finer grids at the wall
finer grid in the expansion zone
reduce time step
more Alpha subcycles
...
Surprisingly the unchanged dam-break settings still obtain the best results. In all other cases the parasitic velocities arise much earlier.
Has anybody more Ideas how to get this problem fixed??

My last idea was to test the interfoamssf-solver (https://code.google.com/p/interfoamssf/) but I'm not very familiar with C-programming and compiling.

My second question is: How can I compile the interfoamssf source code without destroying the rest of my FOAM-installation?

Thanks,
Christoph

alinuman15 October 31, 2017 22:41

Quote:

Originally Posted by aliqasemi (Post 356432)
We have solved the problem of spurious currents in our modified version of interFoam code, you can find the details in a paper (two-phase flow at low capillary numbers / small scales) being published in JCP:

http://dx.doi.org/10.1016/j.jcp.2012.04.011


The Sharp Surafce Force part, described in the paper, is a one line code which any one can easily implement. Smoothing and filtering are also proposed in the paper.

The paper is written for Cartesian meshes, but most parts are general, and now we are using the code for unstructured meshes with very few modifications / change of discretization algorithms. Hopefully these modifications will be published soon as well.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Dear Ali:-
I have found your code on the following link :-
https://figshare.com/articles/poreFoam_package/1155422 ( for reference to others :) )
Can you describe how to modify the new versions of OpenFoam to avoid producing spurious currents in that kind of small scale applications based on that fabulous work! or in a nother words, how can we use it to simulate flow in 10 Microns capillary tubes ?
I highly appreciate your help.
my best

alinuman15 November 2, 2017 12:39

Quote:

Originally Posted by alinuman15 (Post 669931)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Dear Ali:-
I have found your code on the following link :-
https://figshare.com/articles/poreFoam_package/1155422 ( for reference to others :) )
Can you describe how to modify the new versions of OpenFoam to avoid producing spurious currents in that kind of small scale applications based on that fabulous work! or in a nother words, how can we use it to simulate flow in 10 Microns capillary tubes ?
I highly appreciate your help.
my best



I realize that I have to create new solver and use it as a new application but just try to move forward for another question regarding using that solver in the high computation server.
Appreciate your reply !

aliqasemi November 29, 2017 10:53

Quote:

Originally Posted by alinuman15 (Post 669931)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Dear Ali:-
I have found your code on the following link :-
https://figshare.com/articles/poreFoam_package/1155422 ( for reference to others :) )
Can you describe how to modify the new versions of OpenFoam to avoid producing spurious currents in that kind of small scale applications based on that fabulous work! or in a nother words, how can we use it to simulate flow in 10 Microns capillary tubes ?
I highly appreciate your help.
my best

On a HPC server side I think its easier to only compile the poreFoam-3.1-ext, partly based on the instructions in "User-Guide for poreFlow package - direct two-phase flow simulation.pdf" file. My experience is that it can be a challenge to get openfoam compile and work on HPC machines, especially if the compilers/mpi are Intel and you have no Sudo permissions!

For simulating flow through a (10um) tube, you can either mesh it using openfoam blockMesh (which potentially produces the best quality mesh). The alternative approach is to create a 3D image of the tube (for example using Fiji/ImageJ), save it as a 8bit raw file (similar to the Berea.raw) and use AllRunImageTwoPhase script on it (it needs the poreFoam-2.4 OpenFOAM-2.4 to be compiled) to create the mesh. The flow simulations should work on the generated case, but will generate numerical stick-slip behaviour near the contact line, if the capillary number is small. My colleague has developed a more accurate surface force model to alleviate these, ... and we agreed to make it available online, once the algorithm is published, not sure when but hopefully in few months.


All times are GMT -4. The time now is 08:54.