How to make the additional writer active?

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: How to make the additional writer active?

Post by Yvan Fournier »

Hello,

I probably won't have much tim to look at you files before a few days, but here are a few quick indications which may help (especially the last part of this post, if you are simply looking for a simple way to compute the average temperature).

Regarding the GUI on Archer, I need to check with Charles Moulinec (who has done quite a few installs on Archer) if it is possible simple to install the code with the libxml2, so as to be able to read XML files generated by the GUI on other machines). This requires minimal installation effort (compared to PyQt4), and is sufficient if you have another install with the GUI on a workstation to generate XML files. Though after the holiday, Charles and I both have article deadlines for early January, so a new install may wait a bit and not be compatible with your own deadline (I released 3.0.6 recently, and have a few pending fixes for 3.0.7, but am waiting for a few other minor fixes from a colleague before releasing 3.0.7, so mid-January would be a good time for an upgrade of the install on Archer, but that may be too late for you).

The memory allocation issue is probably due to some uninitialized value (1.72E10 is either due to an integer overflow or an uninitialized value), but to debug that, I recommend trying to reproduce the issue on a much smaller mesh with otherwise the same setup, on a workstation, using a debug build, and running under Valgrind. Otherwise, debugging that may be a pain...

If you simply need the temperature average, you can use built-in functions in Code_Saturne, requiring only cs_user_parameters.f90 in version 3.0 (and cs_user_parameters.c in versions 3.3 and 4.0-beta). Search for "moments" or "imom" in cs_user_parameters.f90 and/or the user pdf documentation. Basically, all you need to do is something similar to:

Code: Select all

imom  = 1
idfmom(1,imom) =  iscalt
ntdmom(imom)   =  1 ! starting time step for moment computation
I'm not sure how the moment will be called, unless you change nomvar(ipproc(icdtmo(imom)) (I thing it will be moment_01 for the first moment, and so on).

Regards,

Yvan
MartianDuan
Posts: 74
Joined: Fri Aug 02, 2013 4:26 pm

Re: How to make the additional writer active?

Post by MartianDuan »

Hi Yvan,

Thanks for all of you advices.

The pain I am suffering now is to get the temperature on the wall/boundaries of the fluids domain.

I thought that the temperature would be included in the post-processing files automaticly before. however it seemed not the fact in the case. So What I am doing now is to the get the temperature of the wall/boundaries by using some subroutines. But I did not find the solution yet.

I tried show the results on the bounday by using the cs_user_postprocessing.c, but failed, because of memory problem.

I tried to active the t_plus fild in the cs_user_parameters.f90. I again came a cross the memory problem with a varibale named as 'Var' to be enormous value.

Now I am just trying to find the solution to the problem. And keep my figure crossed.

Thanks for all of your effort. Without of your support It is hard to image that I can reach this point (last bit of the debug).

Yu.
Yvan Fournier wrote:Hello,

I probably won't have much tim to look at you files before a few days, but here are a few quick indications which may help (especially the last part of this post, if you are simply looking for a simple way to compute the average temperature).

Regarding the GUI on Archer, I need to check with Charles Moulinec (who has done quite a few installs on Archer) if it is possible simple to install the code with the libxml2, so as to be able to read XML files generated by the GUI on other machines). This requires minimal installation effort (compared to PyQt4), and is sufficient if you have another install with the GUI on a workstation to generate XML files. Though after the holiday, Charles and I both have article deadlines for early January, so a new install may wait a bit and not be compatible with your own deadline (I released 3.0.6 recently, and have a few pending fixes for 3.0.7, but am waiting for a few other minor fixes from a colleague before releasing 3.0.7, so mid-January would be a good time for an upgrade of the install on Archer, but that may be too late for you).

The memory allocation issue is probably due to some uninitialized value (1.72E10 is either due to an integer overflow or an uninitialized value), but to debug that, I recommend trying to reproduce the issue on a much smaller mesh with otherwise the same setup, on a workstation, using a debug build, and running under Valgrind. Otherwise, debugging that may be a pain...

If you simply need the temperature average, you can use built-in functions in Code_Saturne, requiring only cs_user_parameters.f90 in version 3.0 (and cs_user_parameters.c in versions 3.3 and 4.0-beta). Search for "moments" or "imom" in cs_user_parameters.f90 and/or the user pdf documentation. Basically, all you need to do is something similar to:

Code: Select all

imom  = 1
idfmom(1,imom) =  iscalt
ntdmom(imom)   =  1 ! starting time step for moment computation
I'm not sure how the moment will be called, unless you change nomvar(ipproc(icdtmo(imom)) (I thing it will be moment_01 for the first moment, and so on).

Regards,

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

Re: How to make the additional writer active?

Post by Yvan Fournier »

Hello,

To obtain the mean temperature on the boundary, as soon as you manage to obtain the wall temperature on the whole boundary using post_wall_temperature (for example in cs_user_extra_operations.f90), the rest should be easy.

In your cs_user_parameters.f90 file, in usipsu, you need to set:

Code: Select all

ipstdv(ipsttb) = 1
This should avoid the "memory" (probably uninitialized value) error you have so far.

I assume you do not have access to version 4.4 beta on Archer, but you might have a recent 3.3, which makes all of this much easier (but requires you to udate the rest of your setup)...

Regards,

Yvan
MartianDuan
Posts: 74
Joined: Fri Aug 02, 2013 4:26 pm

Re: How to make the additional writer active?

Post by MartianDuan »

Hello Yvan,

It is really exciting to read your reply ar the 3.30 a.m. I had experienced another frustrating date to find out how to get the value on the boundaries shown in the results.

Actually I had made an progress on obtain the temperol temperature on the boundaries by using

fldid = ivarfl(isca(1))
call field_get_key_int(fldid, keyvis, iflpst)
if (iand(iflpst, 2) .eq. 0) then
iflpst = ior(iflpst, 2)
call field_set_key_int(fldid, keyvis, iflpst)
endif


And your suggest did solve the variable problem. Thanks very much.

I will try to get mean boundary_temperature in cs_user_extra_operations.f90

Thanks again,

Yu.

Yvan Fournier wrote:Hello,

To obtain the mean temperature on the boundary, as soon as you manage to obtain the wall temperature on the whole boundary using post_wall_temperature (for example in cs_user_extra_operations.f90), the rest should be easy.

In your cs_user_parameters.f90 file, in usipsu, you need to set:

Code: Select all

ipstdv(ipsttb) = 1
This should avoid the "memory" (probably uninitialized value) error you have so far.

I assume you do not have access to version 4.4 beta on Archer, but you might have a recent 3.3, which makes all of this much easier (but requires you to udate the rest of your setup)...

Regards,

Yvan
MartianDuan
Posts: 74
Joined: Fri Aug 02, 2013 4:26 pm

Re: How to make the additional writer active?

Post by MartianDuan »

Hi Yvan,

I try to call 'post_boundary_temperature' in the 'cs_user_extra_operations.f90' but unsucessfully.

t does work before I called the particular subrouine. Once I turned it on, I came across some kind of memory issue but I can not figure it out. Please have a look at the attached files.

The 'tempsum' is declared as the global array in the 'cs_us_modules.f90'.

Sorry for bothering your in this early morning.

I can not thanks enough for all of your help.

Best wishes,

Yu.
Yvan Fournier wrote:Hello,

To obtain the mean temperature on the boundary, as soon as you manage to obtain the wall temperature on the whole boundary using post_wall_temperature (for example in cs_user_extra_operations.f90), the rest should be easy.

In your cs_user_parameters.f90 file, in usipsu, you need to set:

Code: Select all

ipstdv(ipsttb) = 1
This should avoid the "memory" (probably uninitialized value) error you have so far.

I assume you do not have access to version 4.4 beta on Archer, but you might have a recent 3.3, which makes all of this much easier (but requires you to udate the rest of your setup)...

Regards,

Yvan
Attachments
cs_user_modules.f90
(3.17 KiB) Downloaded 192 times
cs_user_extra_operations.f90
(6.01 KiB) Downloaded 194 times
listing.log
(50.96 KiB) Downloaded 200 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: How to make the additional writer active?

Post by Yvan Fournier »

Hello,

You seem to mix nfac and nfabor in several places. If you mesh is "thin" (such as 2D extuded over 1 cell), nfabor may be largze than nfac, so be careful. In cs_user_extra_operations.f90, temfbr should be of size nfabor, not ifac*3.

Very importantly, you did not initialize lstfbr (the list of boundary faces), which is needed even if all

Code: Select all

boundary faces are selected (at least in the Fortran layer), so you need a first loop
do ifac = 1, nfabor
  lstfbr(ifac) = ifac
enddo
Also, as you did not post all your user subroutines, I do not know/remember where you called init_user_module, but either you should call it with nfabor instead of nfac as an argument, or replace nfac with nfabor in it.

Regards,

Yvan
MartianDuan
Posts: 74
Joined: Fri Aug 02, 2013 4:26 pm

Re: How to make the additional writer active?

Post by MartianDuan »

Hi Yvan,

Thanks very much. The problem solved now.

Finally I can run the simulation with proper setting.

Happy new year,

Yu.
Yvan Fournier wrote:Hello,

You seem to mix nfac and nfabor in several places. If you mesh is "thin" (such as 2D extuded over 1 cell), nfabor may be largze than nfac, so be careful. In cs_user_extra_operations.f90, temfbr should be of size nfabor, not ifac*3.

Very importantly, you did not initialize lstfbr (the list of boundary faces), which is needed even if all

Code: Select all

boundary faces are selected (at least in the Fortran layer), so you need a first loop
do ifac = 1, nfabor
  lstfbr(ifac) = ifac
enddo
Also, as you did not post all your user subroutines, I do not know/remember where you called init_user_module, but either you should call it with nfabor instead of nfac as an argument, or replace nfac with nfabor in it.

Regards,

Yvan
Post Reply