Solar Load

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
SimBu
Posts: 30
Joined: Tue Sep 13, 2022 4:13 pm

Solar Load

Post by SimBu »

Dear all,

I don't really know if i am in the right section of the forum, otherwise I'll move this post to syrthes realted topics.

I try to reproduce the termal behaviour of a building block, and to simulate it in the atmospheric module. I would really like to add solar load in the simulation, to take in account the solar radiation energy (which if i am correct is not calculated by the atmsopheric module?). This radiation transmits energy to wall boundaries just as the air due to diffuse radiation.

The solar load keep me from including radiation model, and should take in account diffuse radiation, radiation on building and shadow behaviour.

My first intuition was to use Syrthes because there is a special solar radiation option, but I am no longer sure of my approach. Firstly the diffuse radiation is not taken in account, moreover, to use radiation in syrthes, I need to use a 3D approch on syrthes and to use a conduction mesh too. (Which means simulating the internal termal conduction of the buildings, so having a mesh of the building, which i do not have and want)

What could be the best approach ?
  • Should I code a user_boundaries with a solar radiation model, and the same with a thermal source term for the diffuse radiation ? Perharps it is a lot of work for an already existing function...
  • Or the atmospheric model handle the sun radiation and I just didn't find the solar balance option ?
  • Or my Syrthes approach is ok, but then I need some help because i cannot manage to run a case with sun radiation...
Many thanks for any kind of help,

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

Re: Solar Load

Post by Yvan Fournier »

Hello,

Actually, there is a solar radiation model in code_saturne's atmospheric flows module, though I am not sure it is adapted to building or larger-scale areas. I would not bet on shadows, tough the model is DOM (discrete ordinates model) based.

I'll remind people more familiar with the model to check your post, or try to find a simple example.

Best regards,

Yvan
SimBu
Posts: 30
Joined: Tue Sep 13, 2022 4:13 pm

Re: Solar Load

Post by SimBu »

Yvan,
Thanks for your answer,
Indeed a search of the SRC folder led me to clues that solar radiation is taken into account (rayso.f90). I'll do some tests, I'll let you know, though some precisions from a "more familiar person" would be amazing :)

Best regards !
SimBu
Posts: 30
Joined: Tue Sep 13, 2022 4:13 pm

Re: Solar Load

Post by SimBu »

Ok,
I tinkered a little bit, I found the following parameters :
  • In the cs_user_radiative_transfer.c, in the first method cs_user_radiative_transfer_parameters
    the CS_RAD_ATMO_3D_DIRECT_SOLAR and CS_RAD_ATMO_3D_DIFFUSE_SOLAR were what I was searching for.

    However, when I run my simulation with CS_RAD_ATMO_3D_INFRARED, the initialisation fail, so I took it off.
    The second method (cs_user_rad_transfer_absorption)of this file led to a
    SIGSEGV signal (forbidden memory area access)
    error, so I did not search a lot and commented it since I use for now the absorption coefficient from the gui.




  • Moreover, it is said in the user's guide that in order to activate the 1D radiation model :
    This model is activated if the parameter iatra1 is equal to one in the file cs users parameters.f90
    Since iatra1 is defined in atincl.f90, I set iatra1 = 1 in the usipsu subroutine of the cs users parameters.f90. Warning, if iatra1 =1, ivert must be equal to 1 and, the subroutine usatdv of cs_user_atmospheric_model.f90 must be completed


    I tried first without iatra1, (only with CS_RAD_ATMO_3D_DIFFUSE_SOLAR and DIRECT, but I have got an incident flux on the boundaries exposed to the sun of only 1e-12 which to seems very very low. Is it necessary to use the 1D radiation model ? Because for now I have always faced encountered divergence for the direct radiation

Thank you very much in advance!
SimBu
Posts: 30
Joined: Tue Sep 13, 2022 4:13 pm

Re: Solar Load

Post by SimBu »

After some time, I managed to run a very simple case, I'm putting here the src file. The simulation ran with only thermal model effective, in the atmo feature (no wind, no humidity in the air).

Here is a little summary of the step:
In the cs_user_parameter,
  • in the subroutine usppmo, the radiative transfer is activated with iirayo = 1 (DOM)
  • in the subroutine usipsu, the parameter iatra1 = 1 enable 1D radiative transfer (required to have the solar radiance). iatra1 requires to work with the humidity mode of atmo module, and to define vertical levels manually (as it is done in the cs_user_atmospheric_model )
In the cs_user_radiative_transfer, the parameters cs_glob_rad_transfer_params->atmo_model works as three bits and enable solar load (the first bit is for diffuse, then direct and then infrared). It can be initialized by the following CS_RAD_ATMO_3D_INFRARED, CS_RAD_ATMO_3D_DIRECT_SOLAR, CS_RAD_ATMO_3D_DIFFUSE_SOLAR



The simulation finally leads to consistent results, only it quickly ends up with a divergence as it follow :

Code: Select all

   ** Information on the radiative source term
      ----------------------------------------
     Solar direction [0.122318, 0.438305, -0.890465] 


Symmetric Gauss-Seidel [direct_radiation]: divergence after 1 iterations:
  initial residual:         nan; current residual:         nan



/home/user/codesaturne/code_saturne/src/alge/cs_sles_it.c:4667: Fatal error.

Symmetric Gauss-Seidel: error (divergence) solving for direct_radiation


Call stack:
   1: 0x7faff4c344c8 <cs_sles_it_error_post_and_abort+0x98> (libsaturne-7.0.so)
   2: 0x7faff4c2b317 <cs_sles_solve+0x437>            (libsaturne-7.0.so)
   3: 0x7faff4c2c3c4 <cs_sles_solve_native+0x514>     (libsaturne-7.0.so)
   4: 0x7faff482831a <cs_equation_iterative_solve_scalar+0x123a> (libsaturne-7.0.so)
   5: 0x7faff4f70aae <cs_rad_transfer_solve+0x883e>   (libsaturne-7.0.so)
   6: 0x7faff4947f8d <tridim_+0x46cd>                 (libsaturne-7.0.so)
   7: 0x7faff47ae6a7 <caltri_+0x1e77>                 (libsaturne-7.0.so)
   8: 0x7faff589da7a <main+0x71a>                     (libcs_solver-7.0.so)
   9: 0x7faff1cfb555 <__libc_start_main+0xf5>         (libc.so.6)
  10: 0x4015c9     <>                               (cs_solver)
End of stack
The respective listing file is also linked below.


Please, if someting is wrong, let me know. If you have an answer to my convergence issue, let me know as well.

And finally, the solar direct radiation is only vertical, although code saturne is able to compute the solar direction, do you know if I am doing something wrong ?

Best regards,
Attachments
cs_user_radiative_transfer.c
(11.51 KiB) Downloaded 50 times
cs_user_parameters.f90
(16.92 KiB) Downloaded 46 times
cs_user_atmospheric_model.f90
(10.95 KiB) Downloaded 59 times
SimBu
Posts: 30
Joined: Tue Sep 13, 2022 4:13 pm

Re: Solar Load

Post by SimBu »

The list file could not be attached in the previous message :
listing.txt
(1.28 MiB) Downloaded 51 times

I add a screenshot of the two compared cases (on the left, the 1D model is activated, the luminance has the right magnitude, on the right, the solar charge is activated without the 1D model, with a bad magnitude but a good solar direction). If anyone understands how to set parameters in order to have both benefits? I tried to understand atr1vf.f90, and it seems that enable 1D radiation means to have a vertical solar radiation.

comparative_with_out_1Dmodel_.png
SimBu
Posts: 30
Joined: Tue Sep 13, 2022 4:13 pm

Re: Solar Load

Post by SimBu »

I am still wondering how to impose Solar Load with zenith angle, does anybody know how to do it ?

Otherwise I will be interested in the setup files,

Many thanks by advance,
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Solar Load

Post by Yvan Fournier »

Hello,

I am not familiar with the details of the solar radiation model (though Martin is) but if you have a SIGSEGV error on a small case, that us not traced to a user-defined source, and that you could post here (on a single archive to make it more practical), I can chech for bugs.

Best regards,

Yvan
SimBu
Posts: 30
Joined: Tue Sep 13, 2022 4:13 pm

Re: Solar Load

Post by SimBu »

Hello Yvan,
Thank you for your support,
Unfortunately I don't have any errors, I'm just looking for advice / documentations / template cases / help. Anyway, just something to lead me to proper use of solar load but I'm stuck right now....
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Solar Load

Post by Yvan Fournier »

Hello,

Ok, I'll check with Martin when he is available. If I remember correctly, fo the atmospheric model with solar radiation, it is assumed that the direction of gravity is -z, and ground in the XY plane, at least when flat, so there is a difference in handling of downwards (direct) and infra-red terms. This still involves the DOM model (with different directions), but optimized relative to the expected dominant wavelenghts. I am not quite sure about more advanced details for solar direction though.

Best regards,

Yvan
Post Reply