User array post-processing on v6.0.6

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
zeph67
Posts: 52
Joined: Tue Oct 23, 2012 5:54 pm

User array post-processing on v6.0.6

Post by zeph67 »

Hi,

I'm using v6.0.6 and I defined user arrays that I'd like to postprocess.

1) I used cs_user_modules.f90 to create and allocate them. I followed the given example for the C linking.
2) I copied the example given in cs_user_postprocess.c .

But it turns out that the postprocessing of my arrays has not been done. Moreover, I got no error message.

I do not easily understand C unfortunately, and I was far more comfortable with "usvpst" in older versions.

Could someone please help me ?

Thanks in advance, best regards,
Christophe
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: User array post-processing on v6.0.6

Post by Yvan Fournier »

Hello,

Without seeing your code, it is difficult to guess what you may have missed.

Best regards,

Yvan
zeph67
Posts: 52
Joined: Tue Oct 23, 2012 5:54 pm

Re: User array post-processing on v6.0.6

Post by zeph67 »

Actually, as a first step, I was expecting some general advice.

But sure, here are my routines :
- cs_user_modules.f90 where I declare my arrays called 'psiomg' and 'rk'.
- cs_user_postprocess.f90 where the postprocess of these arrays is (supposed to be) done.

I guess that I should call the function "get_user_module_<array_name>" somewhere, but I know neither where nor how (in C).

Thanks,
Christophe
Attachments
cs_user_postprocess.c
(7.86 KiB) Downloaded 114 times
cs_user_modules.f90
(5.29 KiB) Downloaded 109 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: User array post-processing on v6.0.6

Post by Yvan Fournier »

Hello,

Local arrays (in the Fortran module) are not "fields" in the code_saturne API sense, so "field_by_name" wil return NULL. You can check which fields are defined in the setup.log file.

You can define a field either in C, Fortran, or for simple cases such as here, in the GUI (postprocessing/additional user arrays). So the issue here is not really cs_user_postprocess_values vs. usvpst, but using the field logic.

Many examples in the Doxygen documentation (or src/user_examples) provide pore detail (check the cs_user_parameters-base example, or use the GUI).

Regards,

Yvan
zeph67
Posts: 52
Joined: Tue Oct 23, 2012 5:54 pm

Re: User array post-processing on v6.0.6

Post by zeph67 »

OK thanks Yvan.

Most of the time, I don't use the GUI, because I run my computations on remote machines.

So, if I understand what you said, I should create/initialize C fields as it is done in cs_user_parameters-base.c.

But, in this case, what is the point of creating user arrays in cs_user_modules.f90 and passing pointers to C ?

I'm sorry if my questions seem naive, but Code_Saturne is getting more and more complicated (I started using it in 2006, with v1.3.1). I'm totally lost :(

Regards,
Christophe
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: User array post-processing on v6.0.6

Post by Yvan Fournier »

Hello,

cs_user_modules.f90 can be useful mostly for advanced cases if you need to wrap a Fortran library, or a complex set of Fortran routines which can be comparable to a small library.

For simple cases such as sharing a few arrays between C and Fortran, it is not very useful anymore.

Note that even when running on a cluster with no graphical user interface, you can prepare the setup with the GUI on a workstation and use that setup on a cluster.

Yes, the code has evolved a lot since 2006, because many new models were added, and the initial architecture was too limited, and not modular enough. To keep up to date, the best is to check user examples in the Doxygen documentation, as well as peruse the general introduction. The developer's guide (now under Doxygen) can provide information on C/Fortran updates, while being shorter and more targeted than a general C course.

And of course this forum can help for specific questions.

Best regards,

Yvan
Post Reply