|
[Sponsors] |
October 13, 2016, 18:07 |
fvOptions problem in TwoPhaseEulerFoam
|
#1 |
New Member
Mahmoud Shehata
Join Date: Mar 2015
Posts: 13
Rep Power: 11 |
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 |
|
October 19, 2016, 06:59 |
|
#2 |
Member
Join Date: May 2015
Posts: 34
Rep Power: 11 |
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? |
|
October 19, 2016, 12:12 |
|
#3 | |
Member
Kaufman
Join Date: Jul 2013
Posts: 55
Rep Power: 13 |
Quote:
/*--------------------------------*- 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); |
||
October 20, 2016, 13:53 |
|
#5 | |
Member
Kaufman
Join Date: Jul 2013
Posts: 55
Rep Power: 13 |
Quote:
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. |
||
November 9, 2016, 13:33 |
|
#6 |
Member
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17 |
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 |
|
November 9, 2016, 14:19 |
|
#7 |
Member
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17 |
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 |
|
November 9, 2016, 17:06 |
|
#8 |
New Member
Mahmoud Shehata
Join Date: Mar 2015
Posts: 13
Rep Power: 11 |
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? |
|
March 29, 2017, 09:11 |
|
#9 |
New Member
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10 |
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 |
|
March 29, 2017, 11:36 |
|
#10 |
Member
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17 |
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 |
|
March 29, 2017, 12:09 |
|
#11 |
New Member
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10 |
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 |
|
March 29, 2017, 12:16 |
|
#12 |
Member
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17 |
Hi,
Can you post some results when you get them? I'd be interested to see what happens. Regards Jason |
|
March 30, 2017, 15:49 |
|
#13 | |
Member
Kaufman
Join Date: Jul 2013
Posts: 55
Rep Power: 13 |
Quote:
Attached (based on OF4.0) is the test case contributed by Mahmoud. Good luck!! |
||
May 1, 2017, 11:47 |
|
#14 |
New Member
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10 |
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 Last edited by us7; May 4, 2017 at 12:30. Reason: to make question more clear to foamers |
|
May 4, 2017, 12:31 |
|
#15 |
New Member
Umer
Join Date: Aug 2016
Posts: 29
Rep Power: 10 |
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 |
|
Tags |
porosity; fvoptions, twophaseeulerfoam |
|
|
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 |