|
[Sponsors] |
How to add a source term for driving the flow in periodic model by DPMFoam? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 9, 2019, 05:13 |
How to add a source term for driving the flow in periodic model by DPMFoam?
|
#1 |
New Member
Matthew
Join Date: Aug 2017
Posts: 28
Rep Power: 9 |
Hi, all
I am struggle in a two-phase pipe model with cyclic boundary conditions. I would like to solve it using DPMFoam. The problem is that it doesn't work if I add a momentumSource in 'fvOptions' file like the following code. Code:
momentumSource { type meanVelocityForce; active true; meanVelocityForceCoeffs { selectionMode all; fields (U.air); Ubar (0 -24 0); } } Code:
--> FOAM Warning : From function virtual void Foam::fv::option::checkApplied() const in file cfdTools/general/fvOptions/fvOption.C at line 118 Source momentumSource defined for field U.air but never used 1. is there any way to fix the problem of using 'fvOptions'? 2. is that possible to add a certain value in the 'UcEqn.H' file, to drive the flow with a constant bulk velocity? If so, please give me a hit how to modify it. Very appreciate for any help. Regards. |
|
January 9, 2019, 07:30 |
|
#2 |
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
Idea 1: Change active true; to active yes; and try again. At least that is my fvOptions setup and its working.
Idea 2: Are you sure your velocity file is called U.air? Your error clearly states that the field you define your fvOptions for does not exist.
__________________
If you liked my answer to your question, please consider leaving a "Like" in return |
|
January 9, 2019, 07:47 |
|
#3 | |
New Member
Matthew
Join Date: Aug 2017
Posts: 28
Rep Power: 9 |
Quote:
In my DPMFoam solver, the velocity field is U.air for my air phase. That really puzzles me for not exist. I have also tried to use 'U','Uc', still doesn't work. |
||
January 9, 2019, 09:07 |
|
#4 | |
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
Quote:
Code:
tmp<fvVectorMatrix> tUEqn ( fvm::div(phi, U) + MRF.DDt(U) + turbulence->divDevReff(U) == fvOptions(U) ); Code:
fvVectorMatrix UcEqn ( fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc) - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc) + continuousPhaseTurbulence->divDevRhoReff(Uc) == (1.0/rhoc)*cloudSU ); Code:
fvVectorMatrix UcEqn ( fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc) - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc) + continuousPhaseTurbulence->divDevRhoReff(Uc) == (1.0/rhoc)*cloudSU + fvOptions(U) );
__________________
If you liked my answer to your question, please consider leaving a "Like" in return |
||
January 9, 2019, 22:57 |
|
#5 | |
New Member
Matthew
Join Date: Aug 2017
Posts: 28
Rep Power: 9 |
Quote:
Code:
UcEqn.H: In function 'int main(int, char**)': UcEqn.H:7:38: error: 'fvOptions' was not declared in this scope (1.0/rhoc)*cloudSU + fvOptions(Uc) ^ |
||
January 10, 2019, 04:01 |
|
#6 |
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12 |
Try adding #include "fvOptions.H" to your DPMFoam.C
__________________
If you liked my answer to your question, please consider leaving a "Like" in return |
|
October 7, 2020, 08:30 |
|
#7 | |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
Dear Matthew
Did you find your answer? I mean how to use fvOption in DPMfoam Solver? Thanks, Farzad Quote:
|
||
October 7, 2020, 21:35 |
|
#8 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
fvOptions is already added in DPMFoam/MPPICFoam by the following commit:
https://github.com/OpenFOAM/OpenFOAM...714fa03dc67e10 Though it is not in the cell momentum equation, and I don't know why. I guess it should have been added but I don't really know how fvOptions works code-wise. The options I have encountered in other solvers are; fvOptions(U), fvOptions(rho, U), fvOptions(alpha, rho, U). But I didn't see fvOptions(alpha, U). You might try that one or alphac*fvOptions(U). Please share the solution if you find out. Utkan |
|
October 9, 2020, 18:07 |
|
#9 | |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
Dear Utkan Caliskan
Thanks for your response. Which OpenFOAM version you are using? I am using version 6.0 and in version 6.0, in DPMFOAM.c we have; Code:
#include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "PhaseIncompressibleTurbulenceModel.H" #include "pimpleControl.H" Also, I am thinking in the Uceqn.C there must be fvOption in the momentum equation, but I cannot find such a thing. Thanks, Farzad Quote:
|
||
October 19, 2020, 15:51 |
|
#10 | |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
Dear Utkan Caliskan
I did everything to make fvOption work in my simulation. I exactly copied what was in OF8(I mean I have add extra lines to my code). my code compiles fine, but it does not have any effect on the momentum of the specific region which I need. I think, I will stop using fvOption and I will code instead. Thanks, Farzad Quote:
|
||
October 20, 2020, 02:47 |
|
#11 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
Can you tell me which modification you made in the solver?
I suggest you add fvOptions in the cell momentum equation (UcEqn). Code:
fvVectorMatrix UcEqn ( fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc) - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc) + continuousPhaseTurbulence->divDevRhoReff(Uc) == (1.0/rhoc)*cloudSU + alphac*fvOptions(U) ); Utkan |
|
October 20, 2020, 09:46 |
|
#12 | |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
Dear Utkan Caliskan
I did like this; Code:
fvVectorMatrix UcEqn ( fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc) - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc) + continuousPhaseTurbulence->divDevRhoReff(Uc) == (1.0/rhoc)*cloudSU ); UcEqn.relax(); fvOptions.constrain(UcEqn); //new for momentum purpose volScalarField rAUc(1.0/UcEqn.A()); surfaceScalarField rAUcf("Dp", fvc::interpolate(rAUc)); surfaceScalarField phicForces ( fvc::flux(rAUc*cloudVolSUSu/rhoc) + rAUcf*(g & mesh.Sf()) ); if (pimple.momentumPredictor()) { solve ( UcEqn == fvc::reconstruct ( phicForces/rAUcf - fvc::snGrad(p)*mesh.magSf() ) ); fvOptions.correct(Uc); //new for momentum purpose } Thanks, Farzad Quote:
|
||
October 20, 2020, 09:48 |
Coding instead of fvOption
|
#13 |
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8 |
Dear Utkan Caliskan
Finally I decided to code instead of using fvOption, and I did the coding and I have add externalMomentum to the momentum equation in that specific region like this; Code:
forAll(mesh.C(),i) { scalar x = mesh.C()[i].component(0); scalar y = mesh.C()[i].component(1); scalar z = mesh.C()[i].component(2); if(x>0.096 && x<0.404 && y>0.10 && y<0.20 && z>0.0357 && z<0.0643) { externalMomentum[i] = (1.0 ,0.0 ,0.0); } } Code:
ExMom.H:10:22: error: no match for ‘operator=’ (operand types are ‘Foam::Vector<double>’ and ‘double’) externalMomentum[i] = (1.0 ,0.0 ,0.0); Thanks, Farzad |
|
October 26, 2020, 20:29 |
|
#14 |
Member
Utkan Caliskan
Join Date: Aug 2014
Posts: 42
Rep Power: 12 |
Sorry for the late reply. The system didn't allow me to send a reply a few days ago.
I was able to recompile it with that addition. For that one try the following: Code:
forAll(mesh.C(),i) { scalar x = mesh.C()[i].component(0); scalar y = mesh.C()[i].component(1); scalar z = mesh.C()[i].component(2); if(x>0.096 && x<0.404 && y>0.10 && y<0.20 && z>0.0357 && z<0.0643) { externalMomentum[i] = vector(1.0 ,0.0 ,0.0); } } |
|
January 25, 2022, 09:03 |
Success for OF8
|
#15 |
New Member
Kathrin Skinder
Join Date: Apr 2021
Location: Germany, Clausthal-Zellerfeld
Posts: 12
Rep Power: 5 |
Hi, the approach dscian suggested works for me, with the minimal modification of usig Uc instead of U.
Code:
fvVectorMatrix UcEqn ( fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc) - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc) + continuousPhaseTurbulence->divDevRhoReff(Uc) == (1.0/rhoc)*cloudSU + alphac*fvOptions(Uc) ); |
|
January 25, 2022, 10:05 |
How to do this in OpenFOAM 9?
|
#16 |
New Member
Kathrin Skinder
Join Date: Apr 2021
Location: Germany, Clausthal-Zellerfeld
Posts: 12
Rep Power: 5 |
I tried to do the same in OpenFOAM 9, but was somewhat confused.
In OF9, the solver DPMFoam is replaced by the solver denseParticleFoam. Also, fvOptions is replaced by fvModels and fvConstraints. I am using the momentum source correction "meanVelocityForce", which used to be in fvOptions in OF8. Now, In OF9, it seems to be in fvConstraints, according to: https://cpp.openfoam.org/v9/meanVelo...8H_source.html I wanted to try and modify denseParticleFoam in the way that the source correction is done in simpleFoam, which ist Code:
tmp<fvVectorMatrix> tUEqn ( fvm::div(phi, U) + MRF.DDt(U) + turbulence->divDevSigma(U) == fvModels.source(U) ); But of course, this does not include the corrections from fvConstraints. Trying to do something like + fvConstraints.source(Uc) in denseParticleFoam gives the error, that 'class Foam::fvConstraints' has no member 'source'. Simply + fvConstraints(Uc) does not work either, and putting 'meanVelocityForce' in fvModels does not work either. I have to admit, I was just blindly trying some things here, without much knowledge about the background. However, when running the case with simpleFoam the source term corrections ARE taken into account. I suspect, that there is something to these fat printed parts in denseParticleFoam, which has been mentioned before by farzadmech: Code:
fvVectorMatrix UcEqn ( fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc) - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc) + continuousPhaseTurbulence->divDevTau(Uc) == (1.0/rhoc)*cloudSU ); UcEqn.relax(); fvConstraints.constrain(UcEqn); volScalarField rAUc(1.0/UcEqn.A()); volScalarField rASpUc(1.0/(UcEqn.A() - cloudSUp/rhoc)); surfaceScalarField rASpUcf("Dp", fvc::interpolate(rASpUc)); surfaceScalarField phicSUSu ( fvc::flux(rASpUc*cloudSUu/rhoc) + rASpUcf*(g & mesh.Sf()) ); surfaceScalarField phicSUSp ( fvc::interpolate(rASpUc*cloudSUp/rhoc) ); if (pimple.momentumPredictor()) { solve ( UcEqn == fvc::reconstruct ( (phicSUSu + phicSUSp*phic)/rASpUcf - fvc::snGrad(p)*mesh.magSf() ) + (1.0/rhoc)*(fvm::Sp(cloudSUp, Uc) - cloudSUp*Uc) ); fvConstraints.constrain(Uc); } But, since it does not work, I suspect something in 'constain' is somehow not implemented yet for denseParticleFoam. Please excuse the long post. Can anyone provide some clarity? |
|
June 27, 2023, 03:38 |
|
#17 | |
New Member
Kathrin Skinder
Join Date: Apr 2021
Location: Germany, Clausthal-Zellerfeld
Posts: 12
Rep Power: 5 |
It also works to do this:
Code:
fvVectorMatrix UcEqn ( fvm::ddt(alphac, Uc) + fvm::div(alphaPhic, Uc) - fvm::Sp(fvc::ddt(alphac) + fvc::div(alphaPhic), Uc) + continuousPhaseTurbulence->divDevRhoReff(Uc) == (1.0/rhoc)*cloudSU + fvOptions(alphac, Uc) ); Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4foam for OpenFOAM 4.0 | mnikku | OpenFOAM Community Contributions | 80 | May 17, 2022 09:06 |
source in SA model(or one equation model) | lostking18 | CFX | 3 | August 27, 2018 07:39 |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 10:07 |
[Other] How to use finite area method in official OpenFOAM 2.2.0? | Detian Liu | OpenFOAM Meshing & Mesh Conversion | 4 | November 3, 2015 04:04 |
[foam-extend.org] problem when installing foam-extend-1.6 | Thomas pan | OpenFOAM Installation | 7 | September 9, 2015 22:53 |