Syrthes: how to program a user function

This forum is dedicated to Syrthes related issues, as the Syrthes tool does not have its own forum.
Post Reply
Posts: 2
Joined: Mon Nov 03, 2014 6:30 pm

Syrthes: how to program a user function

Post by Johannes_ACKVA » Fri Sep 01, 2017 6:28 pm

I m exploring how to program user functions in Syrthes (to define loads, boundary conditions,..).
I share my results so far and ask for help for the next step.

From the user guide I get that there are 2 levels how to do that:

a function in C-syntax describing the load (mat property or anything else) can be inserted directly in the syrthes input file *.syd. I have done this in the folder "interpreted_function" to describe the Diriclet boundary condition. The syntax is:

Code: Select all

CLIM_T_FCT= DIRICHLET  20+1.e-6*10.*tt    6
where "20+1.e-6*10.*tt" is the function for the boundary condition (tt is the time), "6" means the elements' reference where it is to apply.

(A more simple, not-programmed Diriclet boundary condition would be for example

Code: Select all

which would simply mean "20 degrees onto the (nodes of the) elments of reference 6)

Thus, the appendix "_FCT" in "CLIM_T_FCT" means that a function describes the bc. Not appending "_FCT" means that a simple constant value describes the bc.

When employing this method (1), "CLIM_T_FCT", syrthes creates by itself a c-file, "user_fct.c" which contains the program code for that bc, thus which must not be coded by the user.

The user creates the c-file containing the code. I have done this in the folder "program". I created the c-file by modifying an example taken from the folder "usr_examples", this latter folder is always automatically created when creating a new calculation case using "syrthes.gui" or "syrthes4_create_case". The syntax is:

Code: Select all

CLIM_T_PROG= DIRICHLET                      6
thus no value is given, only the reference number "6". The appendix "_PROG" indicates that syrthes should look for a c-file containing the required information. In my folder this c-file is "user_cond.c". I found that it must reside in the same directory as the syrthes input-file *syd (and not in a subdirectory where it is not found)

I ask for help now to do the following:

I want to apply a flux which is constant in space but variable over time. The variation over time is described by pairs of real numbers, being the time and the flux magnitude respectively. Linear interpolation in between the time points. I m not competent with the C-language, so can somebody please indicate me how to do that?

Many thanks,


CODE-ASTER-courses at Ingenieurbüro für Mechanik, Germany

09-13 October 2017

30 Nov - 01 Dec 2017
(911.74 KiB) Downloaded 130 times

Posts: 18
Joined: Tue Feb 06, 2018 11:49 am

Re: Syrthes: how to program a user function

Post by JonasA » Tue Apr 24, 2018 10:58 am

I may answer a bit late but the way I'd do that is to copy user_ray.c from usr_examples to the case directory and then to modify it according to your need. There is an example about how to set flux magnitude but I have not understood how it works. The time (in second) is in the variable ct. user_ray.c which be called at the beginning of each time step before computing the radiative exchange.

I am not a C expert but you can do your linear interpolation by doing something like that

Code: Select all

if( ct >600.0) {
} else if( 600.0<=ct < 750.0) {
else if( 750.0 <= ct < 900) {
value =a3+b3*ct;
}else{ // time more than 900 seconds
with "value" being what you want to modify and an, bn the parameters of the linear interpolation.

edit: actually, if it is a boundary condition on the conduction mesh, the boundary conduction should be set in user_cond.c not user_ray.c.

Post Reply