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
Boundary condition of heated square cavity flow
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 4080
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Boundary condition of heated square cavity flow
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
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
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
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
-
- Posts: 4080
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Boundary condition of heated square cavity flow
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:
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
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
Regards,
Yvan
Re: Boundary condition of heated square cavity flow
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.
I could get almost same calculation results as tutorial.
Best regards,
Junichi
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
Best regards,
Junichi