CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

fvOptions problem in TwoPhaseEulerFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes
  • 1 Post By mnikku
  • 2 Post By kmefun
  • 3 Post By mshehata85
  • 3 Post By kmefun

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2016, 18:07
Default fvOptions problem in TwoPhaseEulerFoam
  #1
New Member
 
Mahmoud Shehata
Join Date: Mar 2015
Posts: 13
Rep Power: 11
mshehata85 is on a distinguished road
Hi foamers,

I am using Openfoam V 4.0 and I am trying to add a porosity source to the fluidisedBed tutorial to include a pressure drop at a specified mesh zone. I am doing this by specifying an explicitPorositySource --> DarcyForchheimer in the fvOptions file ( please see the attached case).

When I run the case, the solver recognize the settings and start the time iterations. However, I receive many warnings like this:

--> FOAM Warning :
From function virtual void Foam::fv:ption::checkApplied() const
in file cfdTools/general/fvOptions/fvOption.C at line 118
Source porosity1 defined for field U but never used

and the results does not seem to include the porosity source at all. Have anyone faced this problem before???

The same configuration work in other solvers ( simpleFoam for instance). I do not know why I am receiving this error. My only guess is that the fvoptions can not find the velocity field (U) to compute the pressure drop as the twoPhaseEulerFoam has two different velocities (one for the continuous phase U.air and the other for the dispersed one U.particles). If my guess is right, I think that the source code will need to be modified to replace U with U.air. In that case, can anyone tell me which lines needs modifications as I am not a C++ expert.

Thanks in advance

Mahmoud
Attached Files
File Type: zip fluidisedBed.zip (18.6 KB, 50 views)
mshehata85 is offline   Reply With Quote

Old   October 19, 2016, 06:59
Default
  #2
Member
 
Join Date: May 2015
Posts: 34
Rep Power: 11
mnikku is on a distinguished road
Hi,
to me your reasoning sounds right, there is no U but rather U.phase1 and U.phase2. However (without looking at the source code or anything) you should be able to make simple modifications to the source code without huge expertise in C++. Maybe even an alias U.air --> U could be used to take of this?
mshehata85 likes this.
mnikku is offline   Reply With Quote

Old   October 19, 2016, 12:12
Default
  #3
Member
 
Kaufman
Join Date: Jul 2013
Posts: 55
Rep Power: 13
kmefun is on a distinguished road
Quote:
Originally Posted by mshehata85 View Post
Hi foamers,

I am using Openfoam V 4.0 and I am trying to add a porosity source to the fluidisedBed tutorial to include a pressure drop at a specified mesh zone. I am doing this by specifying an explicitPorositySource --> DarcyForchheimer in the fvOptions file ( please see the attached case).

When I run the case, the solver recognize the settings and start the time iterations. However, I receive many warnings like this:

--> FOAM Warning :
From function virtual void Foam::fv:ption::checkApplied() const
in file cfdTools/general/fvOptions/fvOption.C at line 118
Source porosity1 defined for field U but never used

and the results does not seem to include the porosity source at all. Have anyone faced this problem before???

The same configuration work in other solvers ( simpleFoam for instance). I do not know why I am receiving this error. My only guess is that the fvoptions can not find the velocity field (U) to compute the pressure drop as the twoPhaseEulerFoam has two different velocities (one for the continuous phase U.air and the other for the dispersed one U.particles). If my guess is right, I think that the source code will need to be modified to replace U with U.air. In that case, can anyone tell me which lines needs modifications as I am not a C++ expert.

Thanks in advance

Mahmoud
It might work by adding an alias in FvOption as mnikku mentioned, like belows
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1606+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

porosity1
{
type explicitPorositySource;
active yes;

explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porousZone;

type DarcyForchheimer;
UNames (U.air U.particles);
mshehata85 and mikulo like this.
kmefun is offline   Reply With Quote

Old   October 19, 2016, 15:27
Default
  #4
New Member
 
Mahmoud Shehata
Join Date: Mar 2015
Posts: 13
Rep Power: 11
mshehata85 is on a distinguished road
Thank you mnikku and kmefun for your suggestion. I will try it and let you know.

Thanks again
mshehata85 is offline   Reply With Quote

Old   October 20, 2016, 13:53
Default
  #5
Member
 
Kaufman
Join Date: Jul 2013
Posts: 55
Rep Power: 13
kmefun is on a distinguished road
Quote:
Originally Posted by mshehata85 View Post
Thank you mnikku and kmefun for your suggestion. I will try it and let you know.

Thanks again
Hi,

To implement the porosity source in the twoPhaseEulerFoam, the density field for the air and particle have to be registered as well. To Register these two variables, a function object called writeObjects can be used to do that. Good luck.

Last edited by kmefun; October 24, 2016 at 15:03.
kmefun is offline   Reply With Quote

Old   November 9, 2016, 13:33
Default
  #6
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
Hi all,

I'm using OF 4.1 and followed your advice below to add porosity to twoPhaseEulerFoam.

i) I added UNames (U.air U.particles); to the porosity source as you described
ii) I also added writeObjects as follows

writeObjects1
{
type writeObjects;
libs ("libutilityFunctionObjects.so");
objects (rho.air rho.water);
writeOption anyWrite;
}

I get an error as follows:
--> FOAM FATAL ERROR:

request for volScalarField rho.air from objectRegistry region0 failed
available objects of type volScalarField are

27
(
thermo:alpha.air
alpha.air_0
alpha.water_0
thermo:alpha.water
contErr1
alpha.water
T.air
thermosi.water
T.water
contErr2
p_rgh
dpdt
gh
thermosi.air
thermo:rho.water_0
thermo:rho.air
p
K.air
thermo:rho.water
K.water
alpha.air
thermo:mu.water
e.air
thermo:rho.air_0
thermo:mu.air
dgdt
e.water
)

So I tried this instead

writeObjects2
{
type writeObjects;
libs ("libutilityFunctionObjects.so");
objects (thermo:rho.air thermo:rho.water);
writeOption anyWrite;
}

And that does write out the fields
thermo:rho.air and thermo:rho.water, however, I still get the first error above.

I also tried to used the written objects in the 0 file to initialise the solution but this had the same error.

Have you or the others managed to get this working?

Would be grateful for advice how to proceed? Does this shortcut work or do I need to modify the code?

Thanks

Jason

jason is offline   Reply With Quote

Old   November 9, 2016, 14:19
Default
  #7
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
Hello again,

I've changed the line in the DarcyForchheimer.C file from

rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")),

to this

rhoName_(coeffs_.lookupOrDefault<word>("rho", "thermo:rho")),

and recompiled and something seems to be working, will test and post results

there was an error below, it should be UNames (U.air U.water); not UNames (U.air U.particles);

Br

Jason


jason is offline   Reply With Quote

Old   November 9, 2016, 17:06
Default
  #8
New Member
 
Mahmoud Shehata
Join Date: Mar 2015
Posts: 13
Rep Power: 11
mshehata85 is on a distinguished road
Hi All,

I tried the solution proposed by mnikku and kmefun and I improvised to specify the rho in a similar manner and it seems to work. I did not modify the source code at all.

here is the fvOptions code I used:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1606+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

porosity
{
type explicitPorositySource;
active yes;

explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porousZone;
//UName U.air;
UNames (U.particles U.air);
type DarcyForchheimer;

DarcyForchheimerCoeffs
{
d d [0 -2 0 0 0 0 0] (-1 260000000 0);
f f [0 -1 0 0 0 0 0] (-1 42000 0);
rho thermo:rho; // to specify the density
coordinateSystem
{
type cartesian;
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
e2 (0 1 0);
}
}
}
}
}

//************************************************** *********************** //


I attached a sample result for the fluidizedbed case with a vertical porosity source at the domain center line in the vertical direction. It seems ok. However, I am not sure at all that the code is doing what it is supposed to do. Anyone who faced this before could confirm the applicability of this technique?
Attached Images
File Type: jpg 1.jpg (43.1 KB, 129 views)
mshehata85 is offline   Reply With Quote

Old   March 29, 2017, 09:11
Default
  #9
us7
New Member
 
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10
us7 is on a distinguished road
Hello Shehata,
I really need your help. I am also trying to add porosity in twoPhaseEulerFoam. I tried the solution provided by you and i used exactly same fvOptions file but this is not working. Did you change anything else apart of fvOptions?
Thanking you in advance.

Regards,
Umer
us7 is offline   Reply With Quote

Old   March 29, 2017, 11:36
Default
  #10
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
Hello,

It will help if you specify what is wrong, any error messages and simple case files if possible. Before adding in the porosity does your case run as you expect and also converge? Do your porosity coefficients make sense and compare to the porous zone pressure drop you expect from theory?

I also used the same fvOptions but I don't think I ever did get it working as I had to drop the case and work on something else.

I know that fvOptions was added to OF v4.1 so maybe you can try that
https://openfoam.org/release/4-1/
https://github.com/OpenFOAM/OpenFOAM...a59d83cd0f282c

I would still be very interested to see it working.

Jason
jason is offline   Reply With Quote

Old   March 29, 2017, 12:09
Default
  #11
us7
New Member
 
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10
us7 is on a distinguished road
Hello Jason,
Thanks for your quick response. I just succeeded in running this case. I followed same directions as mshehata85 said but i am using OF2.4 so its different to put fvOption in constant. Now its working fine.


Umer
us7 is offline   Reply With Quote

Old   March 29, 2017, 12:16
Default
  #12
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
Hi,
Can you post some results when you get them? I'd be interested to see what happens.
Regards
Jason
jason is offline   Reply With Quote

Old   March 30, 2017, 15:49
Default
  #13
Member
 
Kaufman
Join Date: Jul 2013
Posts: 55
Rep Power: 13
kmefun is on a distinguished road
Quote:
Originally Posted by jason View Post
Hi all,

I'm using OF 4.1 and followed your advice below to add porosity to twoPhaseEulerFoam.

i) I added UNames (U.air U.particles); to the porosity source as you described
ii) I also added writeObjects as follows

writeObjects1
{
type writeObjects;
libs ("libutilityFunctionObjects.so");
objects (rho.air rho.water);
writeOption anyWrite;
}

I get an error as follows:
--> FOAM FATAL ERROR:

request for volScalarField rho.air from objectRegistry region0 failed
available objects of type volScalarField are

27
(
thermo:alpha.air
alpha.air_0
alpha.water_0
thermo:alpha.water
contErr1
alpha.water
T.air
thermosi.water
T.water
contErr2
p_rgh
dpdt
gh
thermosi.air
thermo:rho.water_0
thermo:rho.air
p
K.air
thermo:rho.water
K.water
alpha.air
thermo:mu.water
e.air
thermo:rho.air_0
thermo:mu.air
dgdt
e.water
)

So I tried this instead

writeObjects2
{
type writeObjects;
libs ("libutilityFunctionObjects.so");
objects (thermo:rho.air thermo:rho.water);
writeOption anyWrite;
}

And that does write out the fields
thermo:rho.air and thermo:rho.water, however, I still get the first error above.

I also tried to used the written objects in the 0 file to initialise the solution but this had the same error.

Have you or the others managed to get this working?

Would be grateful for advice how to proceed? Does this shortcut work or do I need to modify the code?

Thanks

Jason

It should work. The fvOptions and controlDict have to be changed correspondingly.
Attached (based on OF4.0) is the test case contributed by Mahmoud.

Good luck!!
Attached Files
File Type: gz fluidisedBed.tar.gz (5.3 KB, 71 views)
BlnPhoenix, us7 and hossam86 like this.
kmefun is offline   Reply With Quote

Old   May 1, 2017, 11:47
Default
  #14
us7
New Member
 
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10
us7 is on a distinguished road
Hello,
I am looking for help related to explicit source term > DarcyForchheimer (porosityModel).

What i am trying to do: -available source term for DarcyForchheimer is Si = -(μ D + 1/2ρ|u|F)ui where D = 1/K , K= intrinsic permeability

-Trying to add is K--> KKri in case of two phase for relative permeability if Kri=alphai^2 then source term will become
Si = -(μ D/(alphai*alphai) + 1/2ρ|u|F)ui
In short i just want to divide D with alpha^2 and alpha value should be coming from the actual solver that is twoPhaseEulerfoam.


How can i link this alphai with solver (twophaseEulerFoam) so it starts taking values( of alpha1 & alhpa2) from the solver. so far i tried this

>modified DarcyForchheimerTemplate.C by changing mu[cellI]*dZones[j]/(alpha[cellI]*alpha[cellI]) + (rho[cellI]*mag(U[cellI]))*fZones[j];

>modified DarcyForchheimer.H by adding "Declared const scalarField& alpha"

but i am getting this error.

/home/umer/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:76:66: error: invalid new-expression of abstract class type ‘FoamrosityModels:arcyForchheimer’

Full image of error is attached

Kind Regards,
Umer
Attached Images
File Type: jpg Capture.jpg (155.2 KB, 29 views)

Last edited by us7; May 4, 2017 at 12:30. Reason: to make question more clear to foamers
us7 is offline   Reply With Quote

Old   May 4, 2017, 12:31
Default
  #15
us7
New Member
 
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10
us7 is on a distinguished road
Hello,
I am looking for help related to explicit source term > DarcyForchheimer (porosityModel).

What i am trying to do: -available source term for DarcyForchheimer is Si = -(μ D + 1/2ρ|u|F)ui where D = 1/K , K= intrinsic permeability

-Trying to add is K--> KKri in case of two phase for relative permeability if Kri=alphai^2 then source term will become
Si = -(μ D/(alphai*alphai) + 1/2ρ|u|F)ui
In short i just want to divide D with alpha^2 and alpha value should be coming from the actual solver that is twoPhaseEulerfoam.


How can i link this alphai with solver (twophaseEulerFoam) so it starts taking values( of alpha1 & alhpa2) from the solver. so far i tried this

>modified DarcyForchheimerTemplate.C by changing mu[cellI]*dZones[j]/(alpha[cellI]*alpha[cellI]) + (rho[cellI]*mag(U[cellI]))*fZones[j];

>modified DarcyForchheimer.H by adding "Declared const scalarField& alpha"

but i am getting this error.

/home/umer/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:76:66: error: invalid new-expression of abstract class type ‘FoamrosityModels:arcyForchheimer’

Full image of error is attached

Kind Regards,
Umer
Attached Images
File Type: jpg Capture.jpg (155.2 KB, 24 views)
us7 is offline   Reply With Quote

Reply

Tags
porosity; fvoptions, twophaseeulerfoam


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
twoPhaseEulerFoam: sudden crash hcen OpenFOAM Running, Solving & CFD 18 September 29, 2020 04:04
Suppress twoPhaseEulerFoam energy AlmostSurelyRob OpenFOAM Running, Solving & CFD 33 September 25, 2018 18:45
twoPhaseEulerFoam: Exceeding iterations, residual = NaN Flyingcircus OpenFOAM Running, Solving & CFD 0 January 2, 2016 14:18
Is twoPhaseEulerFoam applicable to 3D cases / delivering erroneous results? ThomasV OpenFOAM 0 November 11, 2013 09:10
twoPhaseEulerFoam freemankofi OpenFOAM 0 May 23, 2011 17:24


All times are GMT -4. The time now is 03:26.