Page 1 of 1

Fail to compile the thermal source term subroutine

Posted: Wed Dec 13, 2017 5:42 pm
by Jundi He
Hi Code Saturne develop team:

I am using a subroutine to impose the thermal source term for each cell in a channel flow. In the subroutine, I need to use the cell density and velocity (z direction component) to calculate the heat source term. When I try to compile the subroutine, there is an error comes from the cs_field API, the screen shot of the error is shown, and my heat source term subroutine is attached. Did anyone know what the problem is, thanks!

Regards!
Jundi

Re: Fail to compile the thermal source term subroutine

Posted: Thu Dec 14, 2017 1:31 am
by Yvan Fournier
Hello,

Yes, cvar_vel is a 2-dimensional array (dim*cells), so you shoumd not declare it with the other scalar arrays on line 49, but as:

Code: Select all

[double precision, dimension(:,:), pointer :: cvar_vel
on a nearby line (note the double instead of single colons).

Regards,

Yvan

Re: Fail to compile the thermal source term subroutine

Posted: Thu Dec 14, 2017 11:38 am
by Jundi He
Yvan:

OK, thanks! I have another question, if I need to access to the z direction velocity, should I use this:

call field_get_val_v(ivarfl(iw), cvar_vel)
zvelocity=cvar_vel(1,iel)

Regards!
Jundi

Re: Fail to compile the thermal source term subroutine

Posted: Thu Dec 14, 2017 3:37 pm
by Yvan Fournier
Hello,

No, that is the x direction; for the z direction, use:
zvelocity=cvar_vel(3,iel)

Best regards,

Yvan

Re: Fail to compile the thermal source term subroutine

Posted: Mon Dec 18, 2017 1:35 pm
by Jundi He
OK, thanks a lot!