CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Help! Having problem in accessing volume fraction gradient (https://www.cfd-online.com/Forums/fluent-udf/117972-help-having-problem-accessing-volume-fraction-gradient.html)

Geng Fu May 18, 2013 11:44

Help! Having problem in accessing volume fraction gradient
 
Hi, I am using DEFINE_MASS_TRANSFER to add a new phase change model into VOF model.

There is a problem in accessing volume fraction gradient with C_VOF_G. The results of mass transfer rate are 0 on the interface.

After I checked the thread storage(thread, SV_VOF_G), I found it always equals null.

Any help would be appreciated. Thanks in advance.

Code:

  DEFINE_MASS_TRANSFER(liq_gas_source_Sun, cell, thread, from_index, from_species_index, to_index, to_species_index)
  {
    real m_lg; // mass transfer rate on the interface, kg/s/m3 ;
    real h_lg = 2257600; // evaporation enthalpy, J/kg
    real vof_cutoff = 0.05;
    real vpVofT; // dot product of temperature gradient and volume fraction gradient
    real v_sx; // volume fraction gradient dx
    real v_sy; // volume fraction gradient dy
    Thread *liq, *gas;   
    liq = THREAD_SUB_THREAD(thread, from_index);
    gas = THREAD_SUB_THREAD(thread, to_index); //  from_index and to_index are defined in the Mass panel of Phase interaction.
    m_lg = 0.0; // Initial value of m_lg.
 
        if ((C_VOF(cell, liq) > vof_cutoff) && (C_VOF(cell, liq) < (1-vof_cutoff)))
        {                                             
          if (NULL != THREAD_STORAGE(thread,SV_VOF_G))
              {
                v_sx = C_VOF_G(cell, gas)[0];
                v_sy = C_VOF_G(cell, gas)[1]; 
                printf("THREAD_STORAGE : %f \n", THREAD_STORAGE(gas,SV_VOF_G));   
              }
          vpVofT = v_sx*C_T_G(cell, thread)[0] + v_sy*C_T_G(cell, thread)[1];
          printf("v_sy: %f \n", v_sy);
          printf("TempGradx: %f \n", C_T_G(cell, thread)[0]);
          printf("dot product of TempGrad and VOFGrad: %f \n", vpVofT);
          m_lg = 2/h_lg*C_K_L(cell, gas)*vpVofT; //mass transfer rate from liquid to gas;
        }
      return (m_lg);
  }


pranab_jha May 23, 2013 17:31

Hi Geng Fu,

This should solve your problem:
http://www.eureka.im/883.html

Alternatively, you can also enable the temporary solver memory (yes) by using the TUI.
solve-set-expert. I believe its the 4th question in Fluent v6.3.

Geng Fu May 24, 2013 03:05

Quote:

Originally Posted by pranab_jha (Post 429615)
Hi Geng Fu,

This should solve your problem:
http://www.eureka.im/883.html

Alternatively, you can also enable the temporary solver memory (yes) by using the TUI.
solve-set-expert. I believe its the 4th question in Fluent v6.3.

Great thanks for your reply!

I will read the link you gave first.

I already enabled the temporary solver memory.

Thank you again!
All the best.

Geng Fu May 27, 2013 04:11

Quote:

Originally Posted by pranab_jha (Post 429615)
Hi Geng Fu,

This should solve your problem:
http://www.eureka.im/883.html

Alternatively, you can also enable the temporary solver memory (yes) by using the TUI.
solve-set-expert. I believe its the 4th question in Fluent v6.3.

:)Problem solved. Thank you so much!

MichaelVS November 28, 2013 09:20

the same problem
 
Dear Colleagues,

I tried to compile the udf from the link (http://www.eureka.im/883.html), but got the error:

Scalar_Reconstruction: undeclared variable

Did you manage to compile this udf? Everything was fine?

Dear Geng Fu, could you please specify the solution for your original problem?

Geng Fu November 28, 2013 20:04

Quote:

Originally Posted by MichaelVS (Post 463913)
Dear Colleagues,

I tried to compile the udf from the link (http://www.eureka.im/883.html), but got the error:

Scalar_Reconstruction: undeclared variable

Did you manage to compile this udf? Everything was fine?

Dear Geng Fu, could you please specify the solution for your original problem?

Sorry, i solved this problem about half year ago, i really need some time to recall it. This weekend i will redo this process and hope it will help you.

MichaelVS November 29, 2013 03:46

Thank you very much, it is very kind of you!

I am looking forward to hearing from you.

Quote:

Originally Posted by Geng Fu (Post 463967)
Sorry, i solved this problem about half year ago, i really need some time to recall it. This weekend i will redo this process and hope it will help you.


froverstyl1 December 15, 2013 23:54

Hi MichaelVS,

I had same error below.

Scalar_Reconstruction: argument 5 type mismatch (int instead of pointer to function returning void)

And when I compiled the udf not interpreted, there is no such an error. But now, I have an error below when I run calculation.

FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.

or

The UDF library you are trying to load (libudf) is not compiled for 2ddp on the curent platform (win64).

anyone can help?

Geng Fu January 23, 2014 02:40

Quote:

Originally Posted by MichaelVS (Post 463991)
Thank you very much, it is very kind of you!

I am looking forward to hearing from you.

I feel so sorry to reply u two months later.
Hope u have solved your problem. If not, let me have a look at ur case file if possible. nictse911@bit.edu.cn
Sorry again!

Best regards!

hane August 23, 2014 09:55

hamed.moradkhani@yahoo.com
 
do the precedure below
1.define->user-defined->functions->interprated..
interprate the .c file
2.type on the command window of fluent
solve(press enter)
set(press enter)
expert(press enter)
answer for the 4 comming questions respectively are:
no-yes-no-yes

after these 2 steps u can hook the udf from phase intraction->mass tab->user defined->selecting udf...
now you can start runing calculation
inform me about ur results
regards

RAJ KIRAN March 23, 2016 09:52

Hi,

I am having the same problem, mass transfer is always 0. I switched on the temporary solver memory, but that did not solve the problem.

Could you tell me how you solved this issue.

mahdi-united March 13, 2020 08:35

Quote:

Originally Posted by Geng Fu (Post 429695)
Great thanks for your reply!

I will read the link you gave first.

I already enabled the temporary solver memory.

Thank you again!
All the best.

hi
how to store mass fraction gradients in my case?

mahdi-united April 29, 2020 10:27

Quote:

Originally Posted by pranab_jha (Post 429615)
Hi Geng Fu,

This should solve your problem:
http://www.eureka.im/883.html

Alternatively, you can also enable the temporary solver memory (yes) by using the TUI.
solve-set-expert. I believe its the 4th question in Fluent v6.3.

hi

when i run my case in transient mood, this message and error apprear and suddenly FLUENT crashes.


warning: SV_VOF_G not allocated, returning 0
warning: SV_VOF_G not allocated, returning 0
warning: SV_VOF_G not allocated, returning 0


the f1 process could not be started


Error:Error writing "| gzip -2cf > FFF-1-58-00000.dat.gz".
Error object: #f

mahdi-united April 29, 2020 10:29

Quote:

Originally Posted by Geng Fu (Post 428442)
Hi, I am using DEFINE_MASS_TRANSFER to add a new phase change model into VOF model.

There is a problem in accessing volume fraction gradient with C_VOF_G. The results of mass transfer rate are 0 on the interface.

After I checked the thread storage(thread, SV_VOF_G), I found it always equals null.

Any help would be appreciated. Thanks in advance.

Code:

  DEFINE_MASS_TRANSFER(liq_gas_source_Sun, cell, thread, from_index, from_species_index, to_index, to_species_index)
  {
    real m_lg; // mass transfer rate on the interface, kg/s/m3 ;
    real h_lg = 2257600; // evaporation enthalpy, J/kg
    real vof_cutoff = 0.05;
    real vpVofT; // dot product of temperature gradient and volume fraction gradient
    real v_sx; // volume fraction gradient dx
    real v_sy; // volume fraction gradient dy
    Thread *liq, *gas;   
    liq = THREAD_SUB_THREAD(thread, from_index);
    gas = THREAD_SUB_THREAD(thread, to_index); //  from_index and to_index are defined in the Mass panel of Phase interaction.
    m_lg = 0.0; // Initial value of m_lg.
 
        if ((C_VOF(cell, liq) > vof_cutoff) && (C_VOF(cell, liq) < (1-vof_cutoff)))
        {                                             
          if (NULL != THREAD_STORAGE(thread,SV_VOF_G))
              {
                v_sx = C_VOF_G(cell, gas)[0];
                v_sy = C_VOF_G(cell, gas)[1]; 
                printf("THREAD_STORAGE : %f \n", THREAD_STORAGE(gas,SV_VOF_G));   
              }
          vpVofT = v_sx*C_T_G(cell, thread)[0] + v_sy*C_T_G(cell, thread)[1];
          printf("v_sy: %f \n", v_sy);
          printf("TempGradx: %f \n", C_T_G(cell, thread)[0]);
          printf("dot product of TempGrad and VOFGrad: %f \n", vpVofT);
          m_lg = 2/h_lg*C_K_L(cell, gas)*vpVofT; //mass transfer rate from liquid to gas;
        }
      return (m_lg);
  }


hi in your problem, how to calculate latent heat due to mass transfer in FLUENT?


All times are GMT -4. The time now is 09:12.