Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

UDF File for heat source about solar ray tracing

    • konstantinospolychronakis10
      Subscriber

      Hi everyone,

      I am trying to model a floating solar pv in fluent by using the Volume of Fluid method. I am using the solar ray tracing to add the solar irradiance from a specific location. The problem that i am facing is that i want to create a udf file that has as an input value the calculated solar irradiance from the solar caclulator and not a specific value that i could assume. Previously i created a udf file for the heat source by assuming a constant value for the solar irradiation and it was working very well. By searching the manuals of the software i found out that i can store the values of 

      • Direct Normal Solar Irradiation
      • Diffuse Solar Irradiation - Vertical Surface
      • Diffuse Solar Irradiation - Horizontal Surface
      • Ground Reflected Solar Irradiation - Vertical Surface  

      In UDMI Storage. I can not find the command that calls the calculated values from the software to the udf file. I am sending you also my code. The reason that i want the specific values of solar irradiation is that after that i want to use the code for a transient simulation. If anybody can help me about this issue i will be very thankfull. Thank you very much.

       

      #include "udf.h"

      /* Define solar irradiation parameters */
      #define SOLAR_IRRADIANCE 800.0  /* Solar radiation in W/m² */
      #define BASE_EFFICIENCY 0.18     /* Baseline efficiency of PV conversion */

      /* UDF to calculate heat generation considering temperature-dependent PV efficiency */
      DEFINE_SOURCE(heat_source_solar, cell, thread, dS, eqn)
      {
          real heat_source_value;
          real cell_volume;
          real cell_temperature;
          real efficiency;
          real absorptivity = 0.8;  /* Absorptivity assumed constant here */
          
          /* Get the cell temperature */
          cell_temperature = C_T(cell, thread);
          
          /* Define a temperature-dependent efficiency: 
             Efficiency decreases as temperature increases */
          if (cell_temperature < 298.15)
              efficiency = BASE_EFFICIENCY;  /* Base efficiency */
          else
              efficiency = BASE_EFFICIENCY - 0.0004 * (cell_temperature - 298.15);  /* Linear decrease in efficiency */
          
          /* Ensure efficiency does not go below zero */
          if (efficiency < 0.0) 
              efficiency = 0.0;
          
          /* Calculate the heat generation from absorbed solar radiation */
          cell_volume = C_VOLUME(cell, thread); /* Get the volume of the current cell */
          
          /* Fraction of absorbed radiation converted to heat: 
             (1 - efficiency) * absorptivity * solar irradiance */
          heat_source_value = (1.0 - efficiency) * absorptivity * SOLAR_IRRADIANCE/0.0046;

          /* Apply the source term to the energy equation */
          dS[eqn] = 0.0;  /* Derivative of source term with respect to temperature (optional) */
          return heat_source_value;  /* Return the heat source value */
      }

    • Rob
      Forum Moderator

      What is the model for? For a floating array I'd not worry about the solar gain, and for a solar gain I'd not worry about it floating. 

    • konstantinospolychronakis10
      Subscriber

      It is a flexible thin film floating solar panel

    • Rob
      Forum Moderator

      OK, and what does the CFD model do?

    • konstantinospolychronakis10
      Subscriber

      I am trying to model the temperature and as a result the efficiency of the panel. I have the fluid domain and the solar panel in this my using mapped interfaces

    • Rob
      Forum Moderator

      OK, so the free surface isn't really moving? So you don't really need to use the VOF model. 

    • konstantinospolychronakis10
      Subscriber

      No the free surface is moving. I am trying to model the effect of wind and also the effect of waves

    • Rob
      Forum Moderator

      OK, so you want VOF, solar gain and 6DOF in one model? Which will require coding for the solar load on water free surface and potentially for the 6DOF moving mesh part? 

      There are tutorials covering parts of this, but the solar gain on the water free surface isn't simple. 

    • konstantinospolychronakis10
      Subscriber

      Exactly! At first i am not modelling the waves and i assume that the solid body of the is in a standard position. Also i am using a steady state simulation at first. As a first step i want to modify my code to read the irradiation from the solar calculator for a specific location.

    • Rob
      Forum Moderator

      Will the irradiation change if the waves are small? 

    • konstantinospolychronakis10
      Subscriber

      I am thinking that i can model the change of the incident angle of the solar fluxin the pv but i believe that is a step further that the stage that i am right now. Do you know how can i store the values of the solar load calculator?

    • Rob
      Forum Moderator

       

      It’s a heat flux that’s added to the walls. I’m not sure there’s a documentated storage macro, and the actual input comes from a bulk model from ASHRAE which is mentioned in the manual. 

       

    • konstantinospolychronakis10
      Subscriber

      Okay thank you for the guidance! So you believe that is better option to find the solar load datasheet and load it as a parameter set to my code instead of using a macro?

    • Rob
      Forum Moderator

      Possibly. You need to weigh up all the models you're proposing and then review compute resource and time: this is not a simple project! 

Viewing 13 reply threads
  • You must be logged in to reply to this topic.