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

[IHFOAM] The IHFOAM Thread

Register Blogs Community New Posts Updated Threads Search

Like Tree58Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 10, 2014, 11:52
Default
  #41
New Member
 
Diogo R.C.B. Neves
Join Date: Aug 2014
Posts: 16
Rep Power: 12
dneves is on a distinguished road
Thank you for your quick answer.

I will refer IHFOAM according to your instructions.

I will show what I've done after the conference.

Thank you

Best regards
dneves is offline   Reply With Quote

Old   September 10, 2014, 14:19
Default
  #42
New Member
 
Pietro Danilo Tomaselli
Join Date: Oct 2012
Location: Lyngby, DTU
Posts: 9
Rep Power: 14
kobelak is on a distinguished road
Hi all,

I'm trying this new wave generation system for OpenFOAM. Thank you for making the code open-source.

Actually i'm validating the wave generation boundary. I just compiled the generation/absorption libraries and I'm still using interFoam (it is the same as using IHFoam without any porosity, isn'it?)

This is the case I run:
DOMAIN
a 2D wave flume 8m long and 1.2 high (still water level = 1m) with cell size = 0.01m (aspect ratio =1) over all the domain

BOUNDARIES
I followed the baseWaveFlume tutorial, then
inlet: "IH_Waves_InletVelocity" for U, "buoyantPressure" for p, "IH_Waves_InletAlpha" for alpha

outlet
: "IH_3D_2DAbsorption_InletVelocity for U, "buoyantPressure" for p, "zeroGradient" for alpha

bottom and atmosphere: as in the baseWaveFlume tutorial for U,p,alpha

IHWAVESDICT
waveType regular;
waveTheory StokesV;
genAbs 1;
absDir 0.0;
nPaddles 1;
waveHeight 0.1;
wavePeriod 0.767;
waveDir 0.0;
wavePhase 4.71238898;

SETTINGS
fvSchemes and fvSolution as baseWaveFlume tutorial

I ran the case, but the surface elevation results are not so satisfying. According to Fenton solver, the wave should have crest at 0.06m and trough at -0.04m. The solution I got doesn't look like this: there are differences up to 30% both for crest and trough. Moreover it is quite irregular and a bit damped.

I think the mesh is fine enough to get acceptable results and the wave theory is appropriate.
Maybe I have some errors in the settings I'm using...

Has anyone experienced anything similar? Could anyone run the same case to compare my results?

Thanks in advance.

Cheers,

Danilo
kobelak is offline   Reply With Quote

Old   September 12, 2014, 05:12
Default
  #43
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Danilo,

your case setup seems reasonable to me.

However, the damping that you are experiencing is well known and happens with quite steep waves. You may want to play around with the numerics and mesh to obtain better solutions for your case. You can also try applying the streamfunction or cnoidal (although a little bit off) wave theories to see if things get better.

Best regards,

Pablo
Phicau is offline   Reply With Quote

Old   September 12, 2014, 15:11
Default
  #44
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Danilo,

I have been thinking of and following this particular discussion, and I find it quite interesting. I have some questions, because the lack of graphical documentation of the problems makes it hard to diagnose:
  1. Does the irregularity begin immediately or does it occur later in the simulation?
  2. Have you tried plotting the free surface elevation as a function of both space and time in a contour plot, e.g. using Matlab?
  3. Could you upload the surface elevation as a function of time, say 3 wave lengths before the outlet boundary?
I have an intuitive guess for the observed behaviour, namely that the generated wave is close to deep water conditions, but the absorbing boundary condition at the outlet is - to the best of my understanding - based on shallow water wave theory. Therefore, I can easily imagine that considerable amount of energy is reflected (or even created) from the outlet boundary.

This can relatively easy be verified by performing a decomposition of the surface elevation into reflection and incident wave components, e.g. using the methods by Mansard and Funke (1980) or Zelt and Skjelbreia (1992). Both papers are from the Int. Conference on Coastal Engineering.

If you find that the above hypothesis is correct, then this lead me to another and yet more interesting question: How much energy will be reflected of an irregular wave train from an absorbing boundary condition. This is very relevant, since it is highly unlikely that all wave components in an irregular wave train will be in the shallow water limit.

I hope that this has been helpful for further investigation of your curious results.

Kind regards,

Niels
mo_na and Stan Zhou like this.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   September 16, 2014, 09:05
Default
  #45
New Member
 
Pietro Danilo Tomaselli
Join Date: Oct 2012
Location: Lyngby, DTU
Posts: 9
Rep Power: 14
kobelak is on a distinguished road
HI all,

sorry for the late reply.

Thank Niels for the further suggestions you gave me.

Here we have some plots that can help us in the investigation of my results.

I have probed the surface elevation every 0.05 s and the gauges are every 0.05 m.

As soon as I have some time, I will perform a decomposition of the surface elevation into reflection and incident wave components and I will post it as well.

Regards,

Danilo

kobelak is offline   Reply With Quote

Old   September 17, 2014, 12:50
Default 2 Phase Fluid
  #46
New Member
 
AI
Join Date: Jun 2014
Posts: 17
Rep Power: 12
sherif35 is on a distinguished road
Hi Pablo,

Thank you for developing the IHFOAM and making it available to all of us.

I have a question for you,

I'm trying to simulate internal solitary wave between 2 fluid phases in the water and their load effect on a vertical cylinder using LES.

From IHFOAM documentation, it seems that the upper layer is always assumed to be air, and the velocities is that region is set to 0. Additionally the wave height is always assumed to be in the positive z direction.

My question is how difficult would it be to change the above to match my case? Or would it be easier to use groovyBC? I'm still trying to learn both!!

Additionally I just want to confirm that the water depth is set based on the following entry in the "setFieldsDict", so in this case my water depth is 999 m regardless how far the grid extends, correct?

boxToCell or boxToFace
{
box (-999 -999 -999) (999 999 -2.5);

fieldValues
(
volScalarFieldValue alpha.water 1
);
}


Thank you,

Ahmed
sherif35 is offline   Reply With Quote

Old   September 17, 2014, 13:19
Default
  #47
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Ahmed,

in principle you can generate waves between two fluids that share an interface, no matter if these are water and air or two others. As long as interFoam is suitable to simulate them, IHFOAM can handle the waves. However (I am not much into internal waves), you might need to modify the expressions for free surface elevation or velocities, as they might not be the same as for gravity waves.

Yes, at the moment waves must be in the Z direction. This is a soft requirement, as one can always rotate the geometry in order to fulfil it.

This setFieldsDict instruction will fill of water all those cells on your mesh whose centres are contained in a box, ranging from -999 m to 999 m in the X and Y directions and from -999 m to -2.5 m in the Z direction. Assuming that 999 means "very far out the mesh" in your case, your water depth will be -2.5-h, where h is the lowest Z coordinate of your mesh.

Best regards,

Pablo
sherif35 likes this.
Phicau is offline   Reply With Quote

Old   September 20, 2014, 13:38
Default
  #48
Senior Member
 
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 14
pbachant is on a distinguished road
Pablo,

Can you explain some of the main differences between this library and waves2Foam?
__________________
Home | Twitter | GitHub
pbachant is offline   Reply With Quote

Old   September 23, 2014, 06:42
Default
  #49
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi all,

sorry for the late replies, but I am currently carrying out some lab experiments.



@pbachant
the main difference is how wave generation and absorption is treated, since the wave theories used by both are the same.
- waves2Foam generates and absorbs waves in user-defined regions inside the numerical domain. These zones need to be outside your zone of interest: since you prescribe the values of the fields inside them, any measurements/physics within them are useless. This means that you are adding computational cost to your simulations (i.e. many more cells), as these zones are approximately close to a wave length or even more.
- IHFOAM handles wave generation and absorption right at the boundaries. This means that no additional zones are needed, hence, virtually no computational cost is added to the case.


And what does this translate into? Well, we have got some reports from users of both approaches. They were testing a wave focusing and reported very good results, identical in waves2Foam and IHFOAM, but with a significant reduction in computational time for our model (30-50% less time needed). We were told that they are preparing a publication, I will let you know when it is out.


@Niels
True, the absorption BC is based in shallow water waves theory. This does not mean, however, that it does not work quite well for waves in deep waters. The formulation is not new or an invention for IHFOAM. It has been tested for 10+ years in IH2VOF model with excellent results even for shallow water components. In general, reflected energy is below 10-15%, which is a typical level of reflection that you can expect in experimental facilities.


Of course there are advances and room for improvement, as mentioned in IHFOAM's first paper. A development by:


Wellens, P., 2012. Wave simulation in truncated domains for offshore applications.
Ph.D. thesis, Delft University of Technology.


offers increased accuracy when estimating wave celerity. This means that better results are expected for deep waters.


Best,


Pablo
Phicau is offline   Reply With Quote

Old   September 26, 2014, 06:30
Default
  #50
Member
 
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0
hchen is on a distinguished road
Hi all,

I am wondering that in IHFoam for porous media it uses vanGent formula, if I want to use other formulas to calculate A and B, I just need to modify UEqn.H and createPorousity.H, is it enough?

Best regards
Hao
hchen is offline   Reply With Quote

Old   September 26, 2014, 06:47
Default
  #51
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Hao,

yes, createPorosity.H reads and sets the a and b fields, while UEqn.H introduces the full A and B terms.

If you still need 3 terms and just a different expression in the momentum equation I would suggest that only UEqn.H needs to be modified.

Best,

Pablo
Phicau is offline   Reply With Quote

Old   September 26, 2014, 11:07
Default
  #52
Member
 
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0
hchen is on a distinguished road
Hi Pablo:

Thank you for your answer!

And one more question is that, if I do not want to use set field to set the value of porousIndex, and I have a cell set and want to assign the value of porousIndex to that set. Do you have an idea about how to do that?

Best regards
Hao


Quote:
Originally Posted by Phicau View Post
Hi Hao,

yes, createPorosity.H reads and sets the a and b fields, while UEqn.H introduces the full A and B terms.

If you still need 3 terms and just a different expression in the momentum equation I would suggest that only UEqn.H needs to be modified.

Best,

Pablo
hchen is offline   Reply With Quote

Old   September 26, 2014, 11:24
Default
  #53
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Hao,

explore the cellToCell feature of setFieldsDict for that purpose.

Best,

Pablo
Phicau is offline   Reply With Quote

Old   September 26, 2014, 23:53
Default Validations and some test of interFOAM
  #54
New Member
 
Remi Carmi
Join Date: Jul 2014
Posts: 15
Rep Power: 12
rcarmi is on a distinguished road
Hi y'all,

I have been playing around with ihFOAM and I am working on ocean energy so I care a lot about the energy in my simulations.
For the background : I am running the simulations on a Mac with OF222 and my mac version is 10.9.4

Here is the tests I am doing :
1st : I don't use any wave generation or wave absorption (so there is no source or "sink" of energy in the simulations. Any increase is an unstability and any decrease is wether due to physical viscosity (but should be really small) or to numerical viscosity (which can be quite big).

2nd: the mesh :
I have a "tank" of 1 meter long with 0.24 of height
The mesh is cut in three parts :
first part close to the surface : 0.24 to 0.175 I have 156 points in the z direction and dx = 0.005 (constant everywhere)
Then I have a transient part from 0.175 to 0.1 where I use a gradient so the mesh change from the dz near the surface to dz =0.005 and is the same everywhere else.
Last part is uniform mesh

3rd : BC
I have empty in the y direction and slip on the walls and atmosphere for the top (usual)

4th: IC
I fill it with water up to 0.2m
then I deformed the surface using funkySetFields with a cosine function
funkySetFields -time 0 -field alpha1 -expression "pos().z<=0.1+0.01*cos((0.1-pos().y)*2*pi) ? 1 : 0"

5th : the Schemes :
This is probably the most important one. I cleaned a bit the fvSchemes file so I have all the schemes I use only (I started from the wave tank tutorial and in that there is a line div(rho*phi,U) that is useless, it is in div(rho*phi |inter...,U) of the next line).
I have for the gradients : cellMDLimited Gauss linear 1;
for the divergents :
div((rho*phi|interpolate(porosity)),U) I MODIFY THIS ONE (see later)
div(phi,alpha) Gauss vanLeer01;
div(phirb,alpha) Gauss interfaceCompression;
for the laplacian
Gauss linear corrected;
for the time : Euler

I modify the div(rho*phi,U) (the only one left) :
I used :
- upwind : that is crap for energy conservation, a lot of numerical viscosity. But just want to see the behavior. And it is correct
-vanLeerV : It is used in general in the codes
-linear : it is a centered scheme of second order, and almost no num viscosity.

I changed the time-steps for the vanLeerV and I use a constant time step for the simulation.

I sample the Kinetic, potential and the mechanical energy at each time-step of the simulation by adding the fellowing line to the ihFoam.h file :

Quote:
scalar Q = fvc::domainIntegrate(rho*alpha1).value();
massIntegral << runTime.timeName() << " "<< Q << endl;

scalar QQ = fvc::domainIntegrate(rho*mag(U)*mag(U)*.5*alpha1). value();
energyCinIntegral << runTime.timeName() << " "<< QQ << endl;


scalar QQQ = fvc::domainIntegrate(rho*9.81*alpha1*mesh.C().comp onent(2)).value();
energyPotIntegral << runTime.timeName() << " "<< QQQ << endl;


energyTotIntegral << runTime.timeName() << " "<< QQQ+QQ << endl;
I don't use any porosity so I am pretty much doing interFoam solver in PISO.


I ran the fellowing test :
- Case 1 : div = vanLeerV dt =0.001 s
- Case 2 : div = vanLeerV dt = 0.002s
- Case 3 : div = vanLeerV dt =0.0025s
- Case 4 : div = Upwind dt = 0.001s
- Case 5 : div = linear dt = 0.001s
- Case 6 : div = vanLeerV dt =0.001s and ddt = CrankNicholson psi = 0.5

The simulations run for t_{end} = 100s (so more than 100 period). A simulation is about 4 hours.

I plot here the E_k = kinematic energy averaged on one period (T \approx 0.87s) :


If you like to look at it in terms of error = Sqrt[(<E_k>_T - E_k_{Theory})^2]/E_k_{theory}
here is the results :


Comments :
-upwind is damping as expected
-vanLeer gives good results with dt = 0.001s "unstable" (creation of energy) for the two others.
-Linear : unstable (probably required a smaller time step).
-Crank : I don't know why it is so bad...

for dt =0.001s the Courant number oscillates between almost nothing (when the standing waves reach the top position U=0) and 0.21/0.22 when the velocities are maximum. So it is a pretty low Courant number.

I am looking for suggestions on what schemes to use to be sure that the energy is behaving correctly (stable and minimum damping on 100/200 waves periods).


I tried one last thing : adjustableTimeStep on and C<0.1 then it is unstable and behave close to the CrankNicholson one... sad result... I am not trusting the adjustableTimestep in my simulations... Always behave strangely in all the test I have done. The results are always smoother with a constant time step.

I will appreciate any comment. Let me know if I am doing something wrong somewhere... Thanks a lot for your time folks.

Best

Remi
mo_na likes this.
rcarmi is offline   Reply With Quote

Old   September 26, 2014, 23:55
Default Figures
  #55
New Member
 
Remi Carmi
Join Date: Jul 2014
Posts: 15
Rep Power: 12
rcarmi is on a distinguished road
I don't know why they dont show up when I look at the thread here are the link :
Fig 1 :
https://www.dropbox.com/s/befgu4jkq9...hemes.png?dl=0
Fig 2 :
https://www.dropbox.com/s/6524jclgdd...Error.png?dl=0

Best

Remi
rcarmi is offline   Reply With Quote

Old   September 29, 2014, 04:01
Default
  #56
New Member
 
Bo Terp Paulsen
Join Date: Oct 2010
Posts: 13
Rep Power: 16
botp is on a distinguished road
Dear Pablo, congratulations with the release of IHfoam!

I have had a look at the source code and I would appreciate if you could comment on the implementation of porosity.

I understand that the implemented equations slightly differs from the one presented in your "third" paper. From the source code I get the impression that the implemented equations are similar to the one presented in Jensen et al. (2014). However, they differs slightly from the one in waves2Foam, which were implemented by Jensen. Could you please clarify in which way they differs, both in respect to your paper and to the one from Jensen et al. (2014)?
Further, it would be interesting to hear your opinion on what is the correct formulation, as there seems to be some ambiguity at the moment.

I wish you all the best of luck with IHfoam.

Kind regards,
Bo Terp





@article{Jensen2014,
title = "Investigations on the porous media equations and resistance coefficients for coastal structures ",

author = "Bjarne Jensen and Niels Gjøl Jacobsen and Erik Damgaard Christensen",
journal = "Coastal Engineering ",
volume = "84",
number = "0",
pages = "56 - 72",
year = "2014",
doi = "http://dx.doi.org/10.1016/j.coastaleng.2013.11.004",

}
botp is offline   Reply With Quote

Old   October 5, 2014, 13:37
Default
  #57
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi all,

sorry for the (very) late replies, I have been performing lab experiments and I am currently preparing this week's IHFOAM course.

@Remi
This sounds to me like suffering from parasitic currents (large fake velocities at the interface), you should check if this is the case. There are a number of threads in the forum with palliative treatment for them.

@Bo
The mathematical derivations in del Jesus work are not strictly correct, regarding the classic rules of volume averaging. Thus, the formulas in that reference present some flaws, as noted in Jensen's paper, where the correct derivation is made.

Nevertheless, the numerical implementation of del Jesus et al. (2012) equations carried out either in IH3VOF or in IHFOAM corrects most of their deficiencies. In fact, there was only one practical difference with the implementation in Jensen et al. (2014), and that was that additional porosity ought to be introduced in some operators. Comparing both implementations, the results only vary where gradients of porosity appear, i.e. at the interfaces between the porous media. Not many people measure in that locations, as the flow there is very dependent on the local effects (the ones that we try to filter out by volume-averaging). This is the reason why the friction factors (a and b) are so different between the original reference (the third paper) and the current version of IHFOAM. The results are excellent in both cases, though.

The only differences in the implementation of the equations that I would anticipate are those of the closure terms, since we use different approaches.

Best,

Pablo
Phicau is offline   Reply With Quote

Old   October 5, 2014, 15:09
Default
  #58
New Member
 
Remi Carmi
Join Date: Jul 2014
Posts: 15
Rep Power: 12
rcarmi is on a distinguished road
Hi Pablo,

Thanks for your reply. I am not sure I understand what do you suggest... I looked quickly at parasitic current threads and I think the main concern with it is in the case of capillarity driven waves. It is not the case here. waves are large enough such that the waves are driven by gravity. Moreover, "large" (I looked I see factor of four) velocities does not surprised me since the model create a density gradient not aligned with gravity at the interface so I expect large vorticity there (Rayleigh stable problem).
Do you suggest that I modify the pEq file like in this thread (http://www.cfd-online.com/Forums/ope...-currents.html) ? Then why not everyone does that if it is a better description of ocean waves?My aim is to use ocean waves generation after. Here I am just trying to have an idea of what is the timescale I can consider like physical in ihFoam simulation. In other words, after how many wave period should I not trust the results? 3-10-100? Any idea?
Or
Do you suggest that I manually try to diminish the influence of these terms in my calculation of the energy terms (potential and kinetic) by multiplying by alpha1^n (where n>=1, I had 1 before) such that the terms at the interface are dumped?
It will certainly modify slightly the results of the Ek, Ep. Increasing the mesh resolution (diminish the grid size) will have also this effect. But that will not change the fact that the interface is also higher in the simulation.

Btw is there a command to automatically find the interface elevation that I could add in ihFoam.C?
Thanks

Remi
rcarmi is offline   Reply With Quote

Old   October 6, 2014, 06:26
Default
  #59
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Remi,

parasitic currents are terrible for surface tension dominated processes, but they may also play an important (fake) role at macroscale where surface tension can be neglected (e.g. gravity waves). In the end you may be getting very large velocities at the interface, even if the system is at rest and the free surface lies flat, this may be why your energy increases.

What I suggest is that you take this process into account and check the influence of the schemes you are using, you may then have more insights on why your energy increases.

I cannot give you an indication on how many wave periods can be run, you have determine that on your own for your specific cases, but I have run simulations of hundreds of wave periods with very good results.

For the interface elevation thing check the "breakwater" case in the reference materials. You can obtain free surface elevation by sampling and running a python script.

Best,

Pablo
Phicau is offline   Reply With Quote

Old   October 8, 2014, 05:08
Default Parallel computation
  #60
Member
 
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0
hchen is on a distinguished road
Hi,

There is something wrong when I executed the parallel computation.

The error shows that:
Code:
--> FOAM FATAL ERROR: 
Trying to use the dummy Pstream library.
This dummy library cannot be used in parallel mode

    From function Pstream::init(int& argc, char**& argv)
    in file Pstream.C at line 39.

FOAM exiting
But I try the native tutorial in foam-extend-3.1, there is no error reported.

Anybody has idea about the reason?

Best regards
Hao
hchen is offline   Reply With Quote

Reply


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
Divergence detected in AMG solver: k when udf loaded google9002 Fluent UDF and Scheme Programming 3 November 8, 2019 00:34
udf problem jane Fluent UDF and Scheme Programming 37 February 20, 2018 05:17
UDF velocity profile willroca Fluent UDF and Scheme Programming 2 January 10, 2016 04:13
Error messages atg enGrid 7 August 30, 2013 12:16
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 15:37


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