Ostream and sigHandler error
Dear (hopefully knowledgable) openFoam friends,
I am close to running a case which I have been working on for the last 2 weeks. However, there is this last error which I can't seem to resolve. Instead of a normal error message, indicating nicely where my error is, openFoam just seems to crash when I try to run my case. All the preparations seem to be ok, at least, snappyHexmesh returns the shape I expect, with all the correct in and outlet patches. And when I run the same problem in simpleFoam, it seems to work. I switched to reactingFoam as I need to add mixing of Hydrogen in air, and off course, lots of extra inputs are needed for that. But the errors I get are the following: Code:
/*---------------------------------------------------------------------------*\ I can see that the error occurs when I initialise the time loop, as a similar (although 2D) tutorial file runs with the following log. Code:
No fvModels present Can someone explain to me what such an Ostream error means and why it on general occurs? And how is that related to sigHandler? PS: Maybe it is an important aspect, I do use adjustTimeStep with a maxCo of 0.1. I had another case that ran for a certain amount of time steps before it crashed with a similar error. |
After some digging
I decided to open start fiddling around in the solver. So I copied the reactingFoam solver to my own run location and renamed it (using the
HTML Code:
https://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam I started to include print statements to see in which line my code broke, it seems to be the following statement where it crashes: Code:
turbulence->validate(); What would be the exact cause of this? Again, note that it crashes in a way that indicates illegal handling of floats of integers (like division by 0 or roots of negative values). What does this line actually do? With kind regards, Jelle Lagerweij |
Hard to say from the data you share.
I suspect some error in the input (mesh, system folder, constant folder, 0 folder or elsewhere). What is the output of checkMesh? Can you share info on your case? Does e.g. pimpleFoam (no chemistry) run fine? |
1 Attachment(s)
I added my problem as a zip. (if you execute ./run in the terminal it runs the case as I set it up).
I also did a checkMesh and I ran my problem using pimpleFoam. In pimpleFoam it runs fine, but I do have one skewed face. I would expect that there is an error in the initial fields and/or boundaries of N2 or H2. Note that the mesh is not really appropriate for this case (I believe that my cells at the wall are too many wall distances away from it). But for now, I am fine with that. My goal was to just have it working correctly once before I would start implementing the real detailed case. In a similar way, I think that the turbulent intensities at the inlets are also not that correct in their value. I hope that you can help me further. With kind regard Jelle Lagerweij PS: I forgot to adjust the control dictionary. I compiled my own reacting foam solver (with extra print statements), so the application line in the controlDict should be changed from my_reactingFoam to reactingFoam. |
Apologies, I am unwilling to run your case.
I can provide advice. Does reactingFoam run with chemistry turned off? |
Oh, I need to explain the case in a little bit more detail then. I need to check if a room in which hydrogen is produced is vented enough. At an inlet I have a fixed velocity (Fan) and at an outlet, I have a fixed pressure. At the fan, we only have air (I called it N2 to make my live easier).
Additionally, I have an assumed leak of pure hydrogen (another inlet), with some fixed velocity. I want to check how fast the high concentration of hydrogen is mixed with the air and, specifically, if at the outlet of the room the concentration is low enough to be safely released (sub 3 or 4%). Therefore, I have the reactions turned off: Code:
combustionModel none; By changing my own solver, I found that the error occurs just before the real time loop is started my code crashes. (in the line Code:
turbulence->validate(); For N2 it is: Code:
/*--------------------------------*- C++ -*----------------------------------*\ and for H2 it is: Code:
/*--------------------------------*- C++ -*----------------------------------*\ Maybe I made an obvious error somewhere in here. With kind regards Jelle PS: I definitely understand being unwilling to run my code. It is, first of all, unsafe from infections and besides that always a hassle to get right (specific openFoam versions, different computer hardware setup ect.). |
Dear Jelle,
Thank you for your understand. Apologies for the delay in this reply. I humbly suggest to try to run rhoPimpleFoam in a next step. In using reactingFoam, we have repeatedly overlooked setting the boundary condition for the density at the inlet patch appropriately. Once rhoPimpleFoam runs appropriately, we can take a next step. Does this help? Kind wishes. Domenico. |
rhoPimpleFoam test
Dear Domenico,
It helps a lot. I got the task to make this simulation (turbulent two species flow simulation in a 40ft container) during the internship of my master. I only got a 6 core CPU and 64GB of RAM to make it work. I did do some work in Ansys Fluent before and wrote my own laminar axisymmetric CFD code in python, but I have never used openFoam before this. You seem to understand some parts of the inner working, building up the problem to an increasingly more complex case seems to be a much better approach than to start with reactingFoam immediately. At least, we now found the issue at hand. I get the same type of error reporting, in the same place in the solver. While tweaking around for the correct thermophysicalProperties file for the rhoPimpleFoam case, I directly found how I could reduce some computational power in the future. I used Sutherland and Janaf coefficients before, however my case has no reactions, so no large temperature changes are expected. In the rhoPimpleFoam tutorial files, I found examples with const and hconst models for transport and thermodynamical properties respectively. Therefore, I rewrote my thermophysicalProperties file to the following: Code:
FoamFile For sofar, I understood that going from pimpleFoam to rhoPimpleFoam, I need to add the following additional boundary and initial conditions, for T and for alphat. As rhoPimpleFoam does not use multispicies transport yet, I will not have to describe the species distribution. I however get the same error, so it seems that my problem lies with these conditions (or the thermophysical properties file). Lets first show the temperature file. I believe that this one should be correct. I would expect openFoam to compute the density as function of T and p as I used perfectGas as EOS. Code:
FoamFile I must note that my grid is quite rough at the walls. Due to limited computational power, I tried to use as little nodes as possible. I do know that my first cells are around 50 wall distance units large (which is much larger than my turbulence and cfd courses advice me but otherwise the computations will take too long). Maybe this can influence these wall functions so much that it breaks the solver? Although I would expect that the problem then occurs later on in the solver. Code:
FoamFile |
My apologies in case my question that follows comes across as insisting on the previous point raised.
I, however, would like to know what your 0/rho file looks like. Best wishes, D. |
Oeps
Oh, I did not set any 0/rho file. Maybe I understood how the package works incorrectly. I thought that setting the thermophysical properties and the initial pressure and temperature correctly would make the code create its own density field from it. I tried to find examples of such initial density state by looking in the tutorials, but couldn't find them. How should such file look like?
(my current 0 folder (for rhoPimpleFoam) holds the following files: alphat, k, nut, omega, p, T, U. It seems that I need to add a rho file, but did I forget others as well?) |
Yes, thanks a lot :), I got it now.
Your questions made me think back to the meaning of my inputs enough to find what is wrong. Before this, I always used incompressible solvers, but now with rhoPimpleFoam and reactingFoam, I switch to compressible solvers. This changes a lot. In my case, I use the thermoPhysical dictionary file to set all the characteristics of my system. This includes making it an ideal gas. Therefore, the density can be computed from the pressure and the temperature. However, I used gage pressure in my compressible flow simulations. I set the exit pressure to be 0. The ideal gas law will not give a useful result at zero pressure. When the reactingFoam tries to compute some characteristics it will divide by the density and encounter a division by 0... For users with similar issues. There are at least two major input differences between compressible and incompressible models. You need absolute pressure instead of gage pressure. Besides that, be carefull, because the incompressible flow is not directly based on pressure. It wants the pressure divided by the density (m^3*Pa/kg). Whereas the compressible solver needs the absolute pressure in Pa. So if incompressible: use gage pressure/density with dimension of pressure of [0 2 -2 0 0 0 0]. And if it is compressible, set the absolute pressure and give it the as dimension Pa: [1 -1 -2 0 0 0 0]. With kind regards, Jelle lagerweij PS: I just finished the rhoPimpleFoam case succesfully and am now implementing my newly earned knowledge in the reactingFoam case. I am really thankful for Domenico's advice as his comments made me think into the right direction. |
Congrats on the progress that you are making.
Please keep us informed on the progress that you make. Best wishes, Domenico. |
Nearly done
I ran some small cases last week, while preparing the pre- and post-processing of my larger case. I think that I am nearly done with that and can final start to perform the real model (which I will definitely share over here to show of :) ). During that progress, however, I encountered some issues which are not major, but annoying.
I use a bash script (se below) to perform all openFoam tasks automatically. The flow is the following, I perform an rhoSimpleFoam model with only air first, before I copy the right files over to the reactingFoam solver, where I start leaking hydrogen. I like to use foamMonitor to check how the solver performs while the solvers are running. However, if I place the line with Code:
foamMonitor -l ... Code:
runApplication $application Code:
#!/bin/sh Additionally, I want to check the mass conservation of hydrogen over my entire control surface. What we need to ascertain with this model is that no accumulation with hydrogen will occur in the room. Therefore, I want to track the leakage (massflow) of hydrogen at my leak inlet, which is easy as it is pure hydrogen and patchIntegrate phi at that inlet will compute that amount perfectly. But I also want to do something similar at the outlet, now I should not integrate the patch over phi, but over x*phi (with x being the ratio of hydrogen). However, I encountered some problems here, phi is a surfaceScalarField and H2 is a volScalarField. How do I interpolate the volScalarField to the outlet patch surface, multiply it with the local flux field and integrate that? Lastly a short note, I got a weakly turbulent flow and therefore I use kOmegaSST. If I remember it correctly, we would like the wall distance to be between 30 and 300 for that, but my check gives the following result: Code:
yPlus yPlus write: I believe that the wall functions can adjust for the points in the viscous sublayer and buffer layer. Should I track these points with very small y+ values and change my mesh there or is that probably fine? Note that there are some laminar flow regimes as well in my space, so that probably affects these values a lot as well. Sorry for this long list of questions, but I am getting really close. The last 5 weeks feel like a openFoam crash course to me :). With kind regards, Jelle Lagerweij |
Solved the bash file problem
I got the bash file working as I wanted. I added the following lines before the
Code:
runParallel $application Code:
gnome-terminal --tab --title="monitor2" -- bash -c 'sleep 5 && foamMonitor -l postProcessing/residuals/0/residuals.dat' Which seems to work just as I want it to. Now, the only important problem I still have left is this surface integral at the outlet. With kind regards, Jelle Lagerweij |
About the outward flux.
Not sure. How about multiplying rho * normal-component(U) * species-concentration and integrating this quantity over the outlet patch using appropriate post-processing utilities? |
All times are GMT -4. The time now is 16:22. |