|
[Sponsors] |
help:How to get mass integral axial Velocity & momentum |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 3, 2010, 08:04 |
help:How to get mass integral axial Velocity & momentum
|
#1 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Dear Foamers,
I'm working with openFoam (sonicFoam solver), i'm interesting to calculate and plot the equivalent to ''mass integral axial velocity" in respect to this formula: Q=∫rho U_x dV=∑ rho .U_x.V_cell (V_cell= cell volume) How can i calculate Q either with paraview (calculator, integratevariables filters?) Or with OpenFOAM. Any idea please. Any suggestions will be appreciated. Best regards |
|
October 4, 2010, 07:03 |
partial solution
|
#2 |
Senior Member
Emanuele
Join Date: Mar 2009
Posts: 110
Rep Power: 17 |
Hi, you can compute the cell volume with OF introducing in the solver code a piece like this
Code:
forAll(mesh.cells(), cellii) { cellVolume = mesh.V()[cellii]; } Code:
volScalarField cellVolume ( IOobject ( "PecletX", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("cellVolume", dimensionSet(0,3,0,0,0,0,0),1) ); Then you can proceed with integrateVariables i guess Emanuele |
|
October 4, 2010, 07:22 |
|
#3 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Hi Emanuele,
Many thanks to you response. Could you please explain the intergrate filter is it a volume integration? i have to multiply the result by the volume, the number of cells or no? Best regards |
|
October 4, 2010, 07:37 |
|
#4 |
Senior Member
Emanuele
Join Date: Mar 2009
Posts: 110
Rep Power: 17 |
Hi, you can bypass paraview in this way
Add this line in .C solver before the Code:
while (runTime.run()) Code:
OFstream massIntegral("massIntegral.dat"); Code:
forAll(mesh.cells(), celli) { Q+= rho * U[celli] * mesh.V()[cellii]; // i m not sure U = Ux it should be something like this: U.component(0)[celli] } massIntegral << runTime.timeName() << " "<< Q.value() << endl; Code:
dimensionedScalar Q ( "Q", dimensionSet(1,-3,0,0,0), // adjust the dimension here!!! 0.0 ); |
|
October 4, 2010, 07:44 |
|
#5 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Really Thanks a lot Emanuele,
I'll try it and i'll keep you informed. Thanks again!! |
|
October 4, 2010, 09:04 |
|
#6 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Hi Emanuele,
I did what you said step by step but i don't receive any information about my new field Q. Any idea? Best regards |
|
October 4, 2010, 09:21 |
text file
|
#7 |
Senior Member
Emanuele
Join Date: Mar 2009
Posts: 110
Rep Power: 17 |
The solver should have written a file named massIntegral.dat in your case directory. The file contains the values of Q at corresponding values of time
Regards Emanuele |
|
October 4, 2010, 09:29 |
|
#8 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
I didn't find massIntegral.dat,
i have to put this evrywhere (arbitrary location) in runTime loop ?? forAll(mesh.cells(), celli) { Q+= rho * U[celli] * mesh.V()[cellii]; // i m not sure U = Ux it should be something like this: U.component(0)[celli] } massIntegral << runTime.timeName() << " "<< Q.value() << endl; The same for createFields.H ( i put the new lines in a arbitrary location)?? I have to recompile the solver with wmake?? Regards |
|
October 4, 2010, 09:34 |
recompile the solver
|
#9 |
Senior Member
Emanuele
Join Date: Mar 2009
Posts: 110
Rep Power: 17 |
In createFields.H put these lines at the top
Code:
dimensionedScalar Q ( "Q", dimensionSet(1,-3,0,0,0), // adjust the dimension here!!! 0.0 ); |
|
October 4, 2010, 09:41 |
|
#10 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Thanks a lot for your quick response!!
I've put these lines at the top of createFields.H but i receive errors :~/OpenFOAM/OpenFOAM-1.6/applications/solvers/compressible/sonicFoam$ wmake Making dependency list for source file sonicFoam.C SOURCE=sonicFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/basic/lnInclude -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/turbulenceModels/compressible/turbulenceModel -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/sonicFoam.o sonicFoam.C: In function ‘int main(int, char**)’: sonicFoam.C:51: error: ‘OFstream’ was not declared in this scope sonicFoam.C:51: error: ‘massIntegral’ was not declared in this scope sonicFoam.C:85: error: ‘cellii’ was not declared in this scope /home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:8: warning: unused variable ‘momentumPredictor’ /home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’ /home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’ make: *** [Make/linux64GccDPOpt/sonicFoam.o] Error 1 Regards. |
|
October 4, 2010, 09:55 |
adding lines
|
#11 |
Senior Member
Emanuele
Join Date: Mar 2009
Posts: 110
Rep Power: 17 |
Add these lines before the int main on solver .C file:
Code:
#include "OFstream.H" #include <fstream> #include <sstream> #include <string> Code:
mesh.V()[cellii] Code:
mesh.V()[celli] Emanuele |
|
October 4, 2010, 10:03 |
|
#12 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
I'm sorry but i'm receiving errors
Making dependency list for source file sonicFoam.C SOURCE=sonicFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/thermophysicalModels/basic/lnInclude -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/turbulenceModels/compressible/turbulenceModel -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/moumen/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/sonicFoam.o sonicFoam.C: In function ‘int main(int, char**)’: sonicFoam.C:89: error: no match for ‘operator[]’ in ‘Foam::GeometricField<Type, PatchField, GeoMesh>::component(Foam::direction) const [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](0)[celli]’ /home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:8: warning: unused variable ‘momentumPredictor’ /home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’ /home/moumen/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’ make: *** [Make/linux64GccDPOpt/sonicFoam.o] Error 1 |
|
October 4, 2010, 10:06 |
|
#13 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 23 |
Alex, you can do it using Paraview. The first step is to use the Calculator filter to create the field rho*U_0, then apply the Integrate Variables filter in order to integrate this new variable in the whole domain.
Regards.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
October 4, 2010, 10:12 |
|
#14 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Hi santiagomarquezd,
I did that with paraview but the result i had dont correspond for what i had with fluent, it seems tha i have to multiply it with a factor (volume, cell numbers??) Also the integrate filter gives me one line, so i can say that's the integration of the whole domain but i'm confused it indicates cell ID 0, is it an integration for one cell volume or what? Best regards |
|
October 4, 2010, 13:46 |
|
#15 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 23 |
Alex, I checked the integration with a case and it seems to be OK. The line that it is shown reports the whole integral values. Maybe you could check it with a simple case, like a square cavity with given rho and U and then check the results.
Best.
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
October 4, 2010, 14:47 |
|
#16 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Hi santiagomarquezd,
Is it the same for an axisymetric geometry? |
|
October 7, 2010, 08:30 |
Problem solved
|
#17 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Just in case someone's having the same problem and is using the search-function, here's the solution:
Paraview may calculate the momentum :The first step is to use the Calculator filter to create the field then apply the Integrate Variables filter in order to integrate this new variable in the whole domain. But fo axisymetric geometry you have to multiply results by this factor (real Volume/axisymetric volume). Best regards. |
|
October 8, 2010, 00:41 |
|
#18 |
Member
Daniel
Join Date: Jul 2010
Location: California
Posts: 39
Rep Power: 15 |
Hi Alex - I think I am trying to do something similar to what you were doing and I was hoping you might be able to explain how to do it. The solver I am using, dsmcFOAM, outputs mass density and number density (# of molecules per m^3). I was wondering if there was a way in paraFoam to output the number of molecules per cell. Thank you for any and all help.
Thanks |
|
October 8, 2010, 06:57 |
|
#19 |
Member
Alex
Join Date: Mar 2010
Posts: 33
Rep Power: 16 |
Hi hyperion,
I have any experience with dsmcFOAM but since uou have number density (# of molecules per m^3) you have to integrate (i.e paraview filter) it to obtain # of molecules in yous domaine. |
|
October 8, 2010, 11:36 |
|
#20 |
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19 |
Just out of interest, wouldn't
Code:
scalar Q = fvc::domainIntegrate(rho*U_x).value(); |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wind turbine simulation | Saturn | CFX | 58 | July 3, 2020 02:13 |
mass flow in is not equal to mass flow out | saii | CFX | 12 | March 19, 2018 06:21 |
How to define a mass source at a velocity inlet ? | cfdiscool | FLUENT | 4 | June 26, 2014 04:00 |
Periodicity momentum instead of axial momentum | omez | CFX | 1 | August 3, 2009 19:59 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 10:11 |