Boundary Conditions Tutorial

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.


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

Hello,

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

Regards,

Yvan

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
compile.log (3.7 KB)
cs_user_boundary_conditions.f90 (20.7 KB)

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

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
compile.log (8.25 KB)
listing.txt (32.1 KB)

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

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 :

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
tempc_bc1.pdf (11.9 KB)
cs_user_boundary_conditions.f90 (20.6 KB)
compile.log (7.79 KB)

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

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!