CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Gas dispersion in air error message (https://www.cfd-online.com/Forums/openfoam-solving/113945-gas-dispersion-air-error-message.html)

redhoax February 27, 2013 11:03

Gas dispersion in air error message
 
Hello. This is my first post here (after some time lurking) so please be gentle.

I've recently picked up OF and am a novice to the tool.

My case is dispersion of CH4 in an open environment exposed to wind. The domain is just an open box. So far I've set up a case with an inlet for wind from one of the sides, and a small inlet for gas at the floor. The scenario could be an offshore pipeline rupture from which gas(CH4 in my case) has leaked to the surface of the sea, and my task is to look at the dispersion of CH4 in air.

So far the wind is working well, and I did configure the 'gas inlet' to a standard air inlet, just for starters. And up till now I've been using simpleFoam, taking pieces from motorBike and turbineSiting tutorials. Now here's my problem: I'm not able to implement the gas profile into my case. How to make the 'gas inlet' spew out gas instead of air? Any tutorial recommendations?

I've been through several tutorials(ie. counterFlowFlame2D) but it has become a bit too much for me to handle. As mentioned, I am quite the novice, at best.

Also, I recognize that I should throw simpleFoam, and instead use the likes of perhaps reactingFoam? Any help is greatly appreciated! Any help at all. If you want me to provide any info, I'll be happy to.


Cheers,
Lasse

redhoax March 1, 2013 07:21

Gas dispersion in air error message
 
Hi. I'm running a reactingFoam case. kOmegaSST for turbulence, CH4 dispersion in air. no chemistry, no combustion. I get an error message that I'm not capable of interpreting, and was hoping maybe one of you guys were able to, or even if you could tip me on how to learn it. Anyways, here's the error:

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2  Uninterpreted:
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#4  void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleRASModels.so"
#5  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleRASModels.so"
#6  Foam::compressible::RASModels::kOmegaSST::F2() const in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleRASModels.so"
#7  Foam::compressible::RASModels::kOmegaSST::kOmegaSST(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&, Foam::word const&, Foam::word const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleRASModels.so"
#8  Foam::compressible::RASModel::adddictionaryConstructorToTable<Foam::compressible::RASModels::kOmegaSST>::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&, Foam::word const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleRASModels.so"
#9  Foam::compressible::RASModel::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&, Foam::word const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleRASModels.so"
#10  Foam::compressible::turbulenceModel::addturbulenceModelConstructorToTable<Foam::compressible::RASModel>::NewturbulenceModel(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&, Foam::word const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleRASModels.so"
#11  Foam::compressible::turbulenceModel::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::basicThermo const&, Foam::word const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libcompressibleTurbulenceModel.so"
#12  main in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/bin/reactingFoam"
#13  __libc_start_main in "/lib/libc.so.6"
#14  Foam::UOPstream::write(char) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/bin/reactingFoam"

Thank you in advance.

redhoax March 1, 2013 08:57

update
 
So I've discovered it's about "bad mathematics", such as dividing by zero etc.

I tried to turn turbulence off because I thought that might be the issue, but the error message remains the same.

I'm also trying to debug with dbg, not that I really know how, just trying..

redhoax March 1, 2013 09:54

laminar
 
I changed the simulationType to laminar and now the error message changed, so definitely the original one is connected to turbulence. However, the new one looks like this:

Code:

#0  Foam::error::printStack(Foam::Ostream&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2  Uninterpreted:
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#4  Foam::operator/(Foam::UList<double> const&, Foam::UList<double> const&) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#5  main in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/bin/reactingFoam"
#6  __libc_start_main in "/lib/libc.so.6"
#7  Foam::UOPstream::write(char) in "/home/user/OpenFOAM/OpenFOAM-2.1.x/platforms/linuxGccDPOpt/bin/reactingFoam"
Floating point exception

I find it even more mysterious than before. I have not a single clue where this is occurring, nor why. Anyone?

wyldckat March 2, 2013 08:00

Greetings redhoax and welcome to the forum!

I've merged your first post into this thread, because it gives a very good background on what you're trying to achieve!

Nonetheless, it would be helpful if you could share your case, or at least what steps you've taken to prepare said case.

As for the latest error, it does indeed look strange, but very clear: something was divided by zero or infinite! If you feel that you will stumble into these issues very often, then I suggest you have a look into this wiki page: http://openfoamwiki.net/index.php/HowTo_debugging

As for tutorial cases... the only ones I can think of are the "multiphase/twoPhaseEulerFoam" ones, but I'm not familiar enough with it to tell you that it is the solver you're looking for.
Then there is this old thread: http://www.cfd-online.com/Forums/ope...g-gas-gas.html

Best regards,
Bruno

redhoax March 2, 2013 08:51

Hello Bruno - and thank you for your response :)

I did discover those debugging pages late on friday, but haven't had the chance to test them out yet. I do not have the code available today, but I will certainly provide the case and explain my process of building it as soon as I have it before me.

It's not supposed to be a two-phase problem. I have been recommended reactingFoam with reactions turned off. I guess this will enable later development (if I or anyone else see fit) with regards to implementation of ignition sources for possible combustion etc.

Thank you for the link to that old thread. I'll look into it.

Regards,
Lasse

redhoax March 3, 2013 07:32

rough work log
 
Im using OF21x and Salome 6.4.
Case setup is like this:

I have a mesh from Salome. It's an open space with a 'platform' in it (4xcylinder for legs, 1xbox on top, and 1 last cylinder for gas leak inlet under platform). I imported this mesh into the motorBike tutorial. I thought this would be a good starting point. I've used simpleFoam.

I got this to work. Air flow through domain, around and about platform structure: OK. Then I went on to get ABLConditions from the turbineSiting tutorial to form some sort of wind profile instead of a plain air inlet. Got this to work as well(I think..). It converged anyway and looked nice in paraFoam. Still solving with simpleFoam.

The mesh also includes a cylindrical inlet at the bottom of the domain, centered under the platform. I've kept this as a 'wall' up until this point to keep it as simple as possible. Now I it's time to turn it into a patch and the inlet for CH4. And to move on I've been recommended reactingFoam without reactions (for various reasons, one being further case development).

From here on I use the counterFlowFlame2D tutorial as working case (a copy of it, surely). I set chemistryProperties off and combustionProperties false. I set gravity to -9.81 and T to 293 for all. Case still runs.

So now I decided to import my own mesh. The motorBike tutorial uses kOmegaSST, but counterFlowFlame2D uses kEpsilon. I'm not sure which one I should use in my case, but I figured usingkOmegaSST would be simplest for some reason(calculations?).

So, trying to run it I first encountered the initial error, posted first here. So I set simulationType laminar; just to see if that was it. Then the second error I posted came up. This is roughly where I'm at now.

I'll try to compile and debug.

I just want to add that I'm trying with some other mesh also, I'll keep you posted.

wyldckat March 3, 2013 08:42

Hi Lasse,

You forgot to mention what specific values you are using for pressure!

In addition, it would help to know what was the text prior to the stack dump!

edit: what does checkMesh tell you about your own mesh?

Best regards,
Bruno

redhoax March 6, 2013 05:06

steady state. specific value for pressure is set to 0 m^2/s^2.

Code:

internalField  uniform $pressure;

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value          $internalField;
    }
    leak
    {
        type            fixedValue;
        value          $internalField;
    }
    bottom
    {
        type            fixedValue;
        value          $internalField;
    }

    platform
    {
        type            fixedValue;
        value          $internalField;
    }
    #include "frontBackUpperPatches"
}

front, back, upperwall = slip.

The mesh is made in Salome and is 100% tetrahedrons(used NetGEN algorithm). Results from checkMesh look like this:
Code:

Checking geometry...
    Overall domain bounding box (-150 -150 0) (450 150 120)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-2.37253e-19 2.31466e-20 1.3888e-19) OK.
    Max cell openness = 1.43805e-16 OK.
    Max aspect ratio = 4.53093 OK.
    Minumum face area = 16.1359. Maximum face area = 415.675.  Face area magnitudes OK.
    Min volume = 32.9834. Max volume = 2594.62.  Total volume = 2.13241e+07.  Cell volumes OK.
    Mesh non-orthogonality Max: 56.6991 average: 16.6527
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.721447 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

Now here's the thing: the case works when I let out air from the 'leak' inlet and solve with simpleFoam. It is in the transition to reactingFoam and changing this inlet from air to gas that all hell breaks loose.

EDIT: I should mention also that this means modifying reactingFoam into steadystate, as the tutorial case is transient.

I would provide the entire case if you like. Upload to a website or zip and mail it?

Regards,
Lasse

wyldckat March 6, 2013 05:15

Hi Lasse,

:eek: Check your mesh units first!! Does your domain really have 600 x 300 x 120 meters?
Quote:

Code:

    Overall domain bounding box (-150 -150 0) (450 150 120)
[...]
    Min volume = 32.9834. Max volume = 2594.62.  Total volume = 2.13241e+07.  Cell volumes OK.


If your original mesh was in millimeters, you need to properly convert to meters!

But if it's meant to be in meters... you can use Dropbox or something similar ;).

Best regards,
Bruno

redhoax March 6, 2013 05:30

Hehe. It is meant to be in meters. The reason for this is, apparently, it is customary to have 1-2 platform lengths in front and behind of the platform as domain dimensions. Something of the sort goes for width as well. Not quite the same for height, but you get it. should i downscale it a lot? :P

EDIT: https://www.dropbox.com/sh/z0h5xhr6qq10zth/ehvp0eSdRy?m

TIL dropbox is sweet


Lasse

redhoax March 6, 2013 11:35

figured I'd post an overview of challenges going from last converged solution to the current version:

- kOmegaSST vs kEpsilon
- SS vs transient
- perhaps some BCs under 0/, not sure about this
- atmBoundaryLayerInletVelocity (accepted in OF17 but not OF21. this has led me to temporarily changing inlet to a simple inlet of air with fixedValue u=2m/s)


Lasse

wyldckat March 9, 2013 21:06

Hi Lasse,

I finally managed to take a quick look at your case and I spotted that you forgot to re-check the settings on the tutorial "combustion/reactingFoam/ras/counterFlowFlame2D". Some of the ones I managed to find/figure out:
  • Pressure "0/p" is defined with "0 m^2/s^2" as you wrote before, but this definition is only valid for incompressible solvers. reactingFoam apparently is compressible or at least needs to solve "rho" directly, hence the pressure has to be absolute and in Pascal.
  • reactingFoam uses PIMPLE at its core, not SIMPLE. This means that "system/fvSolution" needs to be properly configured, as well as "system/controlDict" has to use smaller "deltaT" values, since it requires the calculation of the Courant number.
I still ended up on a divide by zero as well, but I suggest that you review the settings from the reactingFoam tutorial once again and share the updated case.


A few more suggestions:
  • Doing a full check mesh reveals some sources of concern:
    Code:

    checkMesh -allGeometry -allTopology
    I advise you to go back to an even simpler case made with blockMesh or similar. I suggest that you try "SwiftBlock", if you want to do something a little bit complex: http://openfoamwiki.net/index.php/Contrib/SwiftBlock - this way you can first make sure you have a good mesh and have figured out how to properly configure reactingFoam.
  • Additionally, check the tutorials from "incompressible/pimpleFoam" for a few more ideas on how to work with solvers that need PIMPLE... but I'm just guessing on this one.
Best regards,
Bruno

redhoax March 10, 2013 07:25

woah, thanks a lot!

i'll go through my case real thorough before i get back to you, but eventually i'll give you an update on my progress:)

Lasse

redhoax March 19, 2013 21:22

Hello. Just a short update.

I created a much simpler 2D case with blockMesh, 6mx1.2m. Working on implementing log velocity profile with swak4foam to replace the ablinlet used with simpleFoam. This turned out to be more difficult than expected. As usual :p

I expect to finish this soon. I'll upload the case again when I've worked out the log profile and a few other details!


Lasse

redhoax April 16, 2013 23:49

I updated the case and shared it with you on Dropbox. At the moment I'm experimenting with different variables, such as wind inlet velocity and fuel rate, and trying to decide how to make the platform geometry.

Lasse

wyldckat April 17, 2013 15:20

Hi Lasse,

I received your Dropbox message about the share on my email. I'll try to look into it during the weekend.

Best regards,
Bruno

grk34 April 25, 2013 04:41

Methane dispersion in air
 
Hi redhoax and Wyldckat,

It is interesting redhoax that I am in same situation as you. i am very new to OpenFOAM (and Linux as well) and am struggling to solve CH4 dispersion in ambient air.

i tried to follow the below http://www.personal.psu.edu/dab143/O...ist_slides.pdf

http://openfoamwiki.net/index.php/Fi...Solvers.tar.gz

as this has a feasibility to extend to combustion.

but the problem is I cannot execute edcSimpleFoam after my problem is set Why? :confused:

grk34 April 25, 2013 04:44

meanwhile, redhoax please let me know if you have some breakthrough in solving your problem. your advice is highly valuable.

wyldckat April 26, 2013 19:43

Greetings Vivek and welcome to the forum!

For the problem with edcSimpleFoam, please start a new thread for that topic. And don't forget to specify the OpenFOAM version you're using!

@Lasse: Sorry, I won't be able to look into this before the 2nd of May :(

Best regards,
Bruno


All times are GMT -4. The time now is 23:55.