DelNov / T-Flows

Program for Simulation of Turbulent Flows
Other
109 stars 48 forks source link

Temperature equation does not work properly when periodic BC is used in channel #26

Closed mhadziabdic closed 5 years ago

mhadziabdic commented 6 years ago

Everything goes fine when computation is run in one shot. But once the restart file is used temperature starts decreasing, probably as result of User_Mod_Source function. I modified Source.f90 in User_Mod sub-directory in Process dir, but not in the case directory. Could this somehow be a problem?

Source.f90 is modified as follows:

  !---------------------------------------------------------------------!
  !  Correction of temperature equation with periodic boundary condition! 
  !---------------------------------------------------------------------!
  ! Width of the computational domain
  width = 1.0

  if( phi % name == 'T' ) then
      do m=1,grid % n_materials
        if(bulk(m) % p_drop_x > 1.0e-8.or.&
           bulk(m) % flux_x_o > 1.0e-8) then
          do c = 1, grid % n_cells
            b(c) = b(c) - U % n(c) * heat_flux * width / &
                  (capacity*bulk(m) % flux_x) * grid % vol(c)
          end do
        else if( bulk(m) % p_drop_y > 1.0e-8.or.&
                 bulk(m) % flux_y_o > 1.0e-8) then
            b(c) = b(c) - V % n(c) * heat_flux * width/&
                  (capacity*bulk(m) % flux_y) * grid % vol(c)
        else if( bulk(m) % p_drop_z > 1.0e-8.or.&
                 bulk(m) % flux_z_o > 1.0e-8) then
            b(c) = b(c) - W % n(c) * heat_flux * width/&
                   (capacity*bulk(m) % flux_z) * grid % vol(c)
        end if
      end do
  end if
mhadziabdic commented 6 years ago

I found out that boundary condition for temperature is not written in backup file, so Compute_Temperature does not know anything about temperature boundary conditions.

mhadziabdic commented 6 years ago

I see now the problem, but I need your advice how to solve it. In Load_Boundary_Conditions, boundary type for temperature is read only if in_out is not restart. It is not clear for me why we split boundary type for momentum and temperature.

Niceno commented 6 years ago

Boundary conditions for temperature (as well as other scalars) are split from momentum, because they can have a plethora of combinations. Imagine a wall with fixed heat flux, but fixed value for user scalar 1, and then flux again for user scalar 2, and so forth. We could have almost infinite number of combinations of boundary conditions for scalars, and they can't be associated with grid as the momentum can. Bear in mind that many users will be using scalars for many applications - chemical species, multiphase situations, to name the few.

Niceno commented 6 years ago

Which case was this Hamo? Was it RANS or LES channel?

mhadziabdic commented 6 years ago

It was RANS channel. I am testing it now for channel with the latest code and again i have problem when periodic boundary condition is used. It is something related to boundary cells. There is one more problem which I noticed, Calculate_Face_Geometry.f90 does not compute near_wall_cells because wall and wall_flux BC is not recognized.

mhadziabdic commented 6 years ago

do s = 1, grid % n_faces c1 = grid % faces_c(1,s) c2 = grid % faces_c(2,s)

if(c2 < 0) then
  if(Grid_Mod_Bnd_Cond_Type(grid,c2) .eq. WALL .or.  &
     Grid_Mod_Bnd_Cond_Type(grid,c2) .eq. WALLFL) then
    grid % cell_near_wall(c1) = .true.  
  end if
end if 

end do ! faces

mhadziabdic commented 6 years ago

There is a problem with Grid_Mod_Bnd_Cond_Type it seems.

mhadziabdic commented 6 years ago

I noticed one more thing, probably not related to this issue. Number of iteration for pressure is now ok, it is 0 or around 0, but for W and T it is 4 even residuals are very small, while for other variables is 0 or 1.

Niceno commented 5 years ago

We had this issue five months ago. Did we resolve it in the meanwhile?

mhadziabdic commented 5 years ago

This case is resolved now and temperature equations is working now. Can be closed.

Regards,

Muhamed. Assoc. Prof. Muhamed Hadziabdic Mech. Engineering Program Coordinator Faculty of Engineering and Natural Sciences International University of Sarajevo Hrasnicka cesta 15, 71210, Ilidza, Sarajevo

mob. +387 61 228 489 mail: mhadziabdic@ius.edu.ba

On Fri, Nov 16, 2018 at 12:01 PM Bojan Niceno notifications@github.com wrote:

We had this issue five months ago. Did we resolve it in the meanwhile?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DelNov/T-Flows/issues/26#issuecomment-439359404, or mute the thread https://github.com/notifications/unsubscribe-auth/AeMU-kt0EdwIoRoe0l47cchFKkBNPvt0ks5uvpsYgaJpZM4UeKCC .