Mass balance in code saturne
Posted: Wed May 26, 2010 4:06 pm
Hello,
i am preparing an easy test file for analyze the usage of mass source terms (with only one processor) in code saturne.
To get a thermal balance i am using the routine "usproj.f90" which i have bounded to only balance at inlet and outlet.
For the mass balance i have integrated a function like m = A*v*rho
For the inlet:
massin = 0.0d0 CALL GETFBR('in-hot or in-cold',NLELT,LSTELT) !========== do ilelt = 1, nlelt ifac = lstelt(ilelt) ! --- Element de bord iel = ifabor(ifac) betrag = sqrt(surfbo(1,ifac)**2 + surfbo(2,ifac)**2 + surfbo(3,ifac)**2 ) normal(1) = -surfbo(1,ifac)/betrag normal(2) = -surfbo(2,ifac)/betrag normal(3) = -surfbo(3,ifac)/betrag massin = massin + propce(iel,ipproc(irom(iphas)))*betrag*normal(1)*rtp(iel,iu(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(2)*rtp(iel,iv(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(3)*rtp(iel,iw(iphas))
For the outlet:
massout = 0.0d0 CALL GETFBR('out-cold or out-hot',NLELT,LSTELT) !========== do ilelt = 1, nlelt ifac = lstelt(ilelt) ! --- Element de bord iel = ifabor(ifac) betrag = sqrt(surfbo(1,ifac)**2 + surfbo(2,ifac)**2 + surfbo(3,ifac)**2 ) normal(1) = surfbo(1,ifac)/betrag normal(2) = surfbo(2,ifac)/betrag normal(3) = surfbo(3,ifac)/betrag massout = massout + propce(iel,ipproc(irom(iphas)))*betrag*normal(1)*rtp(iel,iu(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(2)*rtp(iel,iv(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(3)*rtp(iel,iw(iphas))
For the balance:
massbal = massin - massout
While for the energy balance for timesteps < 100 i get an average about zero, the average for the mass balance is about 2.4e-6.
In ensight 9.1.1 i did made an clip at the inlet and one at the outlet to calculate the mass balance and i got a average about 2e-6, too.
In the listing of the calculation the inlet and outlet have the same mass flow ( 0.760000e-2 ).
I do not use mass source terms yet and my time steps are uniform and constant. My grid has an constant hexa cell size of 0.001m and the maximum velocity of 50 m/s. The time step is 0.0002 s. That is coarse, but it should work and the listing shows the right mass balance.
The calculation is incompressible.
Does anyone know what is wrong with my mass balance in "usproj.f90" and ensight 9.1.1 ?
I would be glad if i could fix it.
Best regards,
Patrick
i am preparing an easy test file for analyze the usage of mass source terms (with only one processor) in code saturne.
To get a thermal balance i am using the routine "usproj.f90" which i have bounded to only balance at inlet and outlet.
For the mass balance i have integrated a function like m = A*v*rho
For the inlet:
massin = 0.0d0 CALL GETFBR('in-hot or in-cold',NLELT,LSTELT) !========== do ilelt = 1, nlelt ifac = lstelt(ilelt) ! --- Element de bord iel = ifabor(ifac) betrag = sqrt(surfbo(1,ifac)**2 + surfbo(2,ifac)**2 + surfbo(3,ifac)**2 ) normal(1) = -surfbo(1,ifac)/betrag normal(2) = -surfbo(2,ifac)/betrag normal(3) = -surfbo(3,ifac)/betrag massin = massin + propce(iel,ipproc(irom(iphas)))*betrag*normal(1)*rtp(iel,iu(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(2)*rtp(iel,iv(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(3)*rtp(iel,iw(iphas))
For the outlet:
massout = 0.0d0 CALL GETFBR('out-cold or out-hot',NLELT,LSTELT) !========== do ilelt = 1, nlelt ifac = lstelt(ilelt) ! --- Element de bord iel = ifabor(ifac) betrag = sqrt(surfbo(1,ifac)**2 + surfbo(2,ifac)**2 + surfbo(3,ifac)**2 ) normal(1) = surfbo(1,ifac)/betrag normal(2) = surfbo(2,ifac)/betrag normal(3) = surfbo(3,ifac)/betrag massout = massout + propce(iel,ipproc(irom(iphas)))*betrag*normal(1)*rtp(iel,iu(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(2)*rtp(iel,iv(iphas)) & + propce(iel,ipproc(irom(iphas)))*betrag*normal(3)*rtp(iel,iw(iphas))
For the balance:
massbal = massin - massout
While for the energy balance for timesteps < 100 i get an average about zero, the average for the mass balance is about 2.4e-6.
In ensight 9.1.1 i did made an clip at the inlet and one at the outlet to calculate the mass balance and i got a average about 2e-6, too.
In the listing of the calculation the inlet and outlet have the same mass flow ( 0.760000e-2 ).
I do not use mass source terms yet and my time steps are uniform and constant. My grid has an constant hexa cell size of 0.001m and the maximum velocity of 50 m/s. The time step is 0.0002 s. That is coarse, but it should work and the listing shows the right mass balance.
The calculation is incompressible.
Does anyone know what is wrong with my mass balance in "usproj.f90" and ensight 9.1.1 ?
I would be glad if i could fix it.
Best regards,
Patrick