Boundary Conditions Tutorial

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
GautierR
Posts: 11
Joined: Mon Dec 07, 2015 2:35 pm

Boundary Conditions Tutorial

Post by GautierR »

Hello,

I still on the first tutorial with Code Saturne on the window version. I'm having trouble with the users defined boundary condition by using a subroutine. I tried the following code to define the temperature on the inlet. I'm an expert with python script but comparing to the EXAMPLE file it seem to be similar.

Code: Select all

call getfbr('1', nlelt, lstelt)

if (ttcabs.lt.3.8d0) then
	do ielt = 1, nlelt
		ifac = lstelt(ielt)
		rcodcl(ifac,isca(1),1) = 20.d0 + 100.d0*ttcabs 
	enddo
else
	do ielt = 1, nlelt
		ifac = lstelt(ielt)
		rcodcl(ifac,isca(1),1) = 400.d0
	enddo
endif
The error appears when I try to launch the script, saying that the subroutines are compiled.

I see in few post that could be a version problem. I use the 4.0 version on windows.

Best regards

Gautier
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Boundary Conditions Tutorial

Post by Yvan Fournier »

Hello,

Could you provide the info and files recommended on this forum's guidelines (except the mesh) ?

Regards,

Yvan
GautierR
Posts: 11
Joined: Mon Dec 07, 2015 2:35 pm

Re: Boundary Conditions Tutorial

Post by GautierR »

Hello,

I tried many other thing but I still have the same problem. In attachment are the file correspoding (comple.log and the boundary condition script).

Thanks for your attention

Best regards,

Gautier
Attachments
compile.log
(3.7 KiB) Downloaded 325 times
cs_user_boundary_conditions.f90
(20.67 KiB) Downloaded 355 times
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Boundary Conditions Tutorial

Post by Yvan Fournier »

Hello,

The compile.log file explains all the errors in your subroutine.

You have an invalid character due to removing a "!" character (comment) before a "<".

It seems the Windows version of the compiler does not like tabs, so use spaces for indenting instead.

And you are missing some variable declarations (for example for ielt), so check the examples again.

Regards,

Yvan
GautierR
Posts: 11
Joined: Mon Dec 07, 2015 2:35 pm

Re: Boundary Conditions Tutorial

Post by GautierR »

Hello, thank for your help !

I didn't realize the compile.log file, the errors are actually very well explained. I finally reach to launch the script with the subroutine.

Now, the calculation stop at the first step whitout calculating anything. And i have the following error in the listing : ' SIGSEGV signal (forbidden memory area access) intercepted! '

I put in attachment the listing and compile.log .

Best regards,

Gautier
Attachments
compile.log
(8.25 KiB) Downloaded 329 times
listing.txt
(32.08 KiB) Downloaded 315 times
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Boundary Conditions Tutorial

Post by Yvan Fournier »

Hello,

Unfortunately, on Windows, it seems we do not have a detailed backtrace as we do on most Linux systems (Windows developers who could use the equivalent system-dependent backtrace mechanism would be welcome here).

You have at least one warning about possibly non-initialized variables in your compile.log, so I would try solving that first. Running without user subroutines are adding them progressively also helps pinpoint bugs (most crashes are due to errors in user subroutines).

The documentation of this forum also has some general debugging recommendations.

Regards,

Yvan
GautierR
Posts: 11
Joined: Mon Dec 07, 2015 2:35 pm

Re: Boundary Conditions Tutorial

Post by GautierR »

Hello,

Finally I couls launch the calculation with the script. Thanks to your help, it was indeed a non-initialized variable. The calculation reach the end but I think there's still a mistake in the subroutine.

This subroutine is simply a time-variable boundary condition for the temperature at the inlet (number 1).

Defined with the following lines :

Code: Select all

if (ttcabs.lt.3.8d0) then
 do ielt = 1, nlelt
    ifac = lstelt(ielt)
    rcodcl(ifac,isca(1),1) = 20.d0 + 100.d0*ttcabs
  enddo
else
  do ielt = 1, nlelt
    ifac = lstelt(ielt)
    rcodcl(ifac,isca(1),1) = 400.d0
  enddo
endif
When I plot the TempC variable on the inlet I find a constant value equal to 20 (initial value). I think that the 'ttcabs' time variable variable is not well-defined in my script. But it said in the user's guide that we don't have to do anything with this variable (initialized and uptaded by the code) .

Thank you a lot for your help,

Gautier
Attachments
tempc_bc1.pdf
(11.92 KiB) Downloaded 361 times
cs_user_boundary_conditions.f90
(20.61 KiB) Downloaded 319 times
compile.log
The compile.log where there's no error.
(7.79 KiB) Downloaded 312 times
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Boundary Conditions Tutorial

Post by Yvan Fournier »

Hello,

Do you have any other scalars (user or model-defined) in your data setup ?

isca(1) refers to the first scalar. To be sure to use the temperature (when using the temperature-based thermal model), use isca(iscalt) instead.

Regards,

Yvan
GautierR
Posts: 11
Joined: Mon Dec 07, 2015 2:35 pm

Re: Boundary Conditions Tutorial

Post by GautierR »

Hello,

It was indeed the problem, I had one other scalar define with the GUI. But it set the last scalar define as the first in the species array.

Thank you a lot!
Post Reply