Fail to compile the thermal source term subroutine

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Fail to compile the thermal source term subroutine

Post 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
Attachments
Screenshot from 2017-12-13 15-49-54.png
cs_heat_source_terms.f90
(3.38 KiB) Downloaded 164 times
Yvan Fournier
Posts: 4081
Joined: Mon Feb 20, 2012 3:25 pm

Re: Fail to compile the thermal source term subroutine

Post 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
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Re: Fail to compile the thermal source term subroutine

Post 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
Yvan Fournier
Posts: 4081
Joined: Mon Feb 20, 2012 3:25 pm

Re: Fail to compile the thermal source term subroutine

Post by Yvan Fournier »

Hello,

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

Best regards,

Yvan
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Re: Fail to compile the thermal source term subroutine

Post by Jundi He »

OK, thanks a lot!
Post Reply