Page 1 of 1

Boundary Conditions Tutorial

Posted: Fri Dec 11, 2015 6:22 pm
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

Re: Boundary Conditions Tutorial

Posted: Sat Dec 12, 2015 6:56 pm
by Yvan Fournier
Hello,

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

Regards,

Yvan

Re: Boundary Conditions Tutorial

Posted: Mon Dec 21, 2015 2:58 pm
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

Re: Boundary Conditions Tutorial

Posted: Mon Dec 21, 2015 10:54 pm
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

Re: Boundary Conditions Tutorial

Posted: Tue Feb 09, 2016 4:41 pm
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

Re: Boundary Conditions Tutorial

Posted: Tue Feb 09, 2016 11:38 pm
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

Re: Boundary Conditions Tutorial

Posted: Fri Feb 19, 2016 11:15 am
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

Re: Boundary Conditions Tutorial

Posted: Fri Feb 19, 2016 2:24 pm
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

Re: Boundary Conditions Tutorial

Posted: Fri Feb 19, 2016 3:10 pm
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!