Page 1 of 1

Boundary condition of heated square cavity flow

Posted: Tue Apr 09, 2013 3:29 am
by jun_f_11
Hello everyone,

I'm trying to simulate variable density flow according to an tutorial of heated square cavity flow. In the tutorial, variable density law is described as below.

where, is density at cold wall and is temperature at cold wall boundary.
How can I define density and temperature at cold wall boundary in user subroutine ‘usphyv'?

Thanks in advance,
Junichi Fukui

Re: Boundary condition of heated square cavity flow

Posted: Wed Apr 10, 2013 9:20 am
by Yvan Fournier
Hello,

As recommended in the forum guidelines, could you please specify which version of the code and tutorial you are using ?

You can define the variables you need by using a local variable (they are constant, 0-d values, not "wall-local", 2d values).

The example user subroutines accompanying the tutorial should contain this.

Regards,

Yvan

Re: Boundary condition of heated square cavity flow

Posted: Wed Apr 10, 2013 10:25 am
by jun_f_11
Hello Yvan,

Thank you for your reply.
I'm using Code_Saturne version 3.0 and same version of tutorial.
I agree that we can define the variables we need by using a local variable in subroutine ‘usphyv'. However, I would like to define variables in usphyv that can directly reflect the setting value at cold wall boundary I input in GUI.

Thanks and regards,
Junichi

Re: Boundary condition of heated square cavity flow

Posted: Wed Apr 10, 2013 12:05 pm
by Yvan Fournier
Hello,

In any case, you cannot define the temperature at the boundary in usphyv, as it is a solved variable.

You can define the density at the boundary using something similar to:

Code: Select all

ipbrom = ipprob(irom)
do ifac = 1, nfabor
  iel = ifabor(ifac)
  ...
  propfb(ifac,ipbrom) = ...
enddo
Where you may use the value of the temperature estimated at the wall. To get a temperature estimate at the wall, check the functions available in src/base/cs_post_util.f90 (called in src/base dvvpst.f90).

Regards,

Yvan

Re: Boundary condition of heated square cavity flow

Posted: Wed Apr 17, 2013 1:27 am
by jun_f_11
Thank you, Yvan,

I tried to use an array rcodcl(ifac, ivar, 1) for import boundary wall temperature (, ) input in GUI into calculation of thermal expansion coefficient in subroutine usphyv. However, the attempt was unsuccessful, since usphyv is called before input boundary wall temperature into rcodcl(ifac, ivar, 1).

Finally, I defined boundary wall temperature as local variables in usphyv, and calculated thermal expansion coefficient as below.

Code: Select all

  g_mag_z = sqrt(gx * gx + gy * gy + gz * gz)
  leng_z  = 1.d0
  ra_z    = 1.d+6
  tc_z    = 293.15d0
  th_z    = 303.15d0
  dtemp_z = th_z - tc_z
  rho_c_z = 1.2039d0
  
  t_diff_z= 2.59d-2
  visc_z  = 1.83d-5
  cp_z    = 1004.84d0 

  do iel = 1, ncel
    xrtp   = rtp(iel,ivart)
    rho_z    = propce(iel,ipproc(irom))
    beta_z = ra_z * t_diff_z * visc_z / (rho_z * rho_z * cp_z * g_mag_z * dtemp_z * leng_z * leng_z * leng_z)
    propce(iel,ipcrom) = rho_c_z * (1.d0 - beta_z * (xrtp - tc_z))
  enddo
I could get almost same calculation results as tutorial.

Best regards,
Junichi