
[Sponsors] 
September 10, 2014, 10:52 

#41 
New Member
Diogo R.C.B. Neves
Join Date: Aug 2014
Posts: 16
Rep Power: 12 
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 

September 10, 2014, 13:19 

#42 
New Member
Pietro Danilo Tomaselli
Join Date: Oct 2012
Location: Lyngby, DTU
Posts: 9
Rep Power: 13 
Hi all,
I'm trying this new wave generation system for OpenFOAM. Thank you for making the code opensource. 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 

September 12, 2014, 04:12 

#43 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 
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 

September 12, 2014, 14:11 

#44 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,902
Rep Power: 37 
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:
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
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

September 16, 2014, 08:05 

#45 
New Member
Pietro Danilo Tomaselli
Join Date: Oct 2012
Location: Lyngby, DTU
Posts: 9
Rep Power: 13 
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 

September 17, 2014, 11:50 
2 Phase Fluid

#46 
New Member
AI
Join Date: Jun 2014
Posts: 17
Rep Power: 12 
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 

September 17, 2014, 12:19 

#47 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 
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.5h, where h is the lowest Z coordinate of your mesh. Best regards, Pablo 

September 23, 2014, 05:42 

#49 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 
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 userdefined 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 (3050% 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 1015%, 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 

September 26, 2014, 05:30 

#50 
Member
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0 
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 

September 26, 2014, 05:47 

#51 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 
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 

September 26, 2014, 10:07 

#52 
Member
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0 
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 

September 26, 2014, 10:24 

#53 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 
Hi Hao,
explore the cellToCell feature of setFieldsDict for that purpose. Best, Pablo 

September 26, 2014, 22:53 
Validations and some test of interFOAM

#54  
New Member
Remi Carmi
Join Date: Jul 2014
Posts: 15
Rep Power: 12 
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.1pos().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*phiinterpolate(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 timesteps for the vanLeerV and I use a constant time step for the simulation. I sample the Kinetic, potential and the mechanical energy at each timestep of the simulation by adding the fellowing line to the ihFoam.h file : Quote:
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 

September 26, 2014, 22:55 
Figures

#55 
New Member
Remi Carmi
Join Date: Jul 2014
Posts: 15
Rep Power: 12 
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 

September 29, 2014, 03:01 

#56 
New Member
Bo Terp Paulsen
Join Date: Oct 2010
Posts: 13
Rep Power: 16 
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", } 

October 5, 2014, 12:37 

#57 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 
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 volumeaveraging). 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 

October 5, 2014, 14:09 

#58 
New Member
Remi Carmi
Join Date: Jul 2014
Posts: 15
Rep Power: 12 
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.cfdonline.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? 310100? 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 

October 6, 2014, 05:26 

#59 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19 
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 

October 8, 2014, 04:08 
Parallel computation

#60 
Member
Hao Chen
Join Date: Aug 2014
Posts: 66
Rep Power: 0 
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 Anybody has idea about the reason? Best regards Hao 

Thread Tools  Search this Thread 
Display Modes  


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 7, 2019 23:34 
udf problem  jane  Fluent UDF and Scheme Programming  37  February 20, 2018 04:17 
UDF velocity profile  willroca  Fluent UDF and Scheme Programming  2  January 10, 2016 03:13 
Error messages  atg  enGrid  7  August 30, 2013 11:16 
Phase locked average in run time  panara  OpenFOAM  2  February 20, 2008 14:37 