gradient magnitude is returning zero value!!?

  • 40 Views
  • Last Post 3 weeks ago
  • Topic Is Solved
vidyadhar posted this 3 weeks ago

Hello,

I am using a VOF simulation containing two phases. I have initialized the domain with volume fraction of secondary phase=1 in liquid region and 0 in vapor region.

I wanted to incorporate a source term like below:

if (C_VOF(cell,cell_thread)!=0.0 && C_VOF(cell,cell_thread)!=1.0)

{

   source=3.2*(C_T(cell,cell_thread)-T_SAT)*(C_VOF_G(cell,cell_thread)[0]);

   printf("source= %g\n",source);

}

When I print the value of source, I am getting a value of zero. If I remove the term (C_VOF_G(cell,cell_thread)[0]), then I get non-zero values.

I request any one to let me know why gradient is returning a value of zero.

Thanks & Regards,

vidyadhar

Order By: Standard | Newest | Votes
abenhadj posted this 3 weeks ago

This means the first component of the VOF gradient is zero. 

 

How did you calculated the gradients? Can you post-process them?

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Hi,

I did not calculate the gradients. I thought they will be calculated if I use the gradient vector macros. Is it not so?

If I have to calculate can you give me any lead in doing so.

 

Thanks & Regards,

Vidyadhar

abenhadj posted this 3 weeks ago

The official way is not to freeze memory. In Fluent console solve/set/expert then answer Keep temporary solver memory from being freed with yes.

The gradients are only available if you are defining a source term in the related equations (as an example..)

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Hi,

I have selected "YES" in Fluent console when it prompted for "keep temporary solver memory from being freed". I have done this already.

Since I am using VOF method, I am solving VOF equation. So, I think I can access C_VOF_G().

The idea was this: I was defining source term and assigning it into a user defined memory variable- this process has been done in DEFINE_ADJUST macro. Then this UDMI containing the source term is used in DEFINE_MASS_TRANSFER macro.

It is not clear to me, if i am doing any mistake by doing like this.

 

OR

Should I assign C_VOF to C_UDSI and then use C_UDSI_G to evaluate VOG gradient?

An example this way has been given in the Fluent customization manual (Example UDF that Utilizes UDM and UDS Variables)

 

Thanks & Regards,

vidyadhar

 

 

 

 

abenhadj posted this 3 weeks ago

I cannot follow the need for DEFINE_ADJUST if one can do everything within the DEFINE_MASS_TRANSFER UDF. Please check the contour plot of gradient of VOF in GUI if they are zero or not. If they are not zero then the error lies else where.

Best regards,

Amine

vidyadhar posted this 3 weeks ago

I am sorry to bother you. I do not find any field variable to represent gradient of vof in GUI.

I am not sure how to do that. Can you please help me how to do it. Is there a way?

 

Thanks & Regards,

Vidyadhar

abenhadj posted this 3 weeks ago

Contour plots of Gradient under Phase-1 or Phase-2

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Sorry. I did not see properly. I found "Smoothed VOF Gradient Magnitude" in contours.

I can find non-zero values in GUI.

So, what do you mean by error lies elsewhere?

 

Thanks & Regards,

Vidyadhar

 

abenhadj posted this 3 weeks ago

Meaning that the error is in your UDF either the Adjust (do no why you need that) or in Mass transfer UDF. Please start debugging that. 

As ANSYS Stuff we can just provide general guidance and we do not debug UDF's. 

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Thank you Amine for the support.

I will review my UDF.

I have seen ANSYS report on evaporation, which also shows using Adjust and MassTransfer Macros.

Please see Page 5 in the attachment or the image as shown here.

Thanks & Regards,

vidyadhar

Attached Files

abenhadj posted this 3 weeks ago

I know that report and the UDF behind it. But as you raised the question you did not tell what really you are doing.

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Hi Amine,

I am trying to model evaporation at microscale by using the macros as described in the report.

In that process, I raised the question of C_VOF_G resulting zero values.

 

Thanks & Regards,

Vidyadhar

 

abenhadj posted this 3 weeks ago

What is the objective of your ADJUST: Is it to calculate the inter-facial area and source term? Are you calculating the gradients in the ADJUST?

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Hello Amine,

Yes, my objective is to write an expression for mass flux at the interface. This involves calculating interfacial area term (which is given by gradient of volume fraction of primary phase).

Then this expression for mass flux is to be applied in the cells at the interface via UDMI. This process has to be done using DEFINE_ADJUST Macro.

Then by using DEFINE_MASS_TRANSFER Macro, I would like to apply the mass flux terms present in UDMI for mass transfer between the two phases.

Thanks & Regards,

Vidyadhar

abenhadj posted this 3 weeks ago

Okay. That means in the Adjust you are allocating the gradient and calculating them and then freeing the memory? If yes please then switch off the TUI command under solver/set/expert mentioned in the beginning.

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Hello Amine,

If I enter "YES" when prompted for /solve/set/expert/ -----> Keep Temporary solver memory from being freezed, then only the field function Smoothed VOF Gradient Magnitude becomes available for post-processing (eg., in contours) and shows non-zero values at the interface.

If I enter "NO", then the field function Smoothed VOF Gradient Magnitude is not available.

I am sending the UDF herewith as an attachment. I am not expecting you to debug it. But, I request you to please look into it.

Attached Files

rwoolhou posted this 3 weeks ago

We're not allowed to open attachments, please can you post the UDF. We're also very limited in how much we can help here due to the restrictions on us (ANSYS staff) in a public forum. 

abenhadj posted this 3 weeks ago

I won't have a look into the UDF. As ANSYS Stuff I won't download any attachments. You can post lines of the UDF here. I thought you are calculating the gradients in the UDF that is why my last message.

Best regards,

Amine

vidyadhar posted this 3 weeks ago

#include "udf.h"

 #define T_SAT 343

 DEFINE_ADJUST(my_adjust, mixture_domain)

 {

    real source;

                real mag;

                int phase_domain_index;

    cell_t cell;

    Thread *cell_thread;

                Domain *subdomain;

    sub_domain_loop(subdomain, mixture_domain, phase_domain_index)

    {

    thread_loop_c (cell_thread,subdomain)

    { begin_c_loop_all (cell,cell_thread)

     { if(NNULLP(THREAD_STORAGE(cell_thread,SV_VOF_G)))

                  {  if (C_VOF(cell,cell_thread)!=0.0 && C_VOF(cell,cell_thread)!=1.0)

                                {

                                                source=3.2*(C_T(cell,cell_thread)-T_SAT)*(C_VOF_G(cell,cell_thread)[0]);

                                                C_UDMI(cell,cell_thread,0) = source;

                                                printf("source= %g\n",source);

                                } } } end_c_loop_all (cell,cell_thread)

    } }

  }

 DEFINE_MASS_TRANSFER(liq_gas_source,cell,thread,from_index,from_species_index,to_index,to_species_index)

 {

                Thread *gas=THREAD_SUB_THREAD(thread,to_index);

                Thread *liq=THREAD_SUB_THREAD(thread,from_index);

                if(C_T(cell,thread)>=T_SAT)

                                { return C_UDMI(cell,thread,0); }

 }

abenhadj posted this 3 weeks ago

is C_DUMI(c,t,0) pointing now to zero?

Make a test and patch with a diffused interface in your case (because of the condition). If still zero then I will check if the gradients are not zero.

 

Best regards,

Amine

vidyadhar posted this 3 weeks ago

Hi,

Yes, C_UDMI is pointing to zero.

I need to calculate gradients in the ADJUST means?

Should I assign C_VOF to C_UDSI and then use C_UDSI_G to evaluate VOG gradient?

An example this way has been given in the Fluent customization manual (Example UDF that Utilizes UDM and UDS Variables)

 

Thanks & Regards,

Vidyadhar

 

abenhadj posted this 3 weeks ago

Please check the condition at first by patching a diffused interface. Moreover add some other UDMI's to store the components of gradients.  

Best regards,

Amine

vidyadhar posted this 3 weeks ago

After I have initialized, I have already patched my liquid region with volume fraction 1. Please see the image here. So, is it what that you have mentioned "Please check the condition at first by patching a diffused interface" 

abenhadj posted this 3 weeks ago

and now store the Gradients in the UDMI's without having the NNULP line (comment out). I want that you debug the condition and the gradients..

Best regards,

Amine

abenhadj posted this 3 weeks ago

Looking in the UDF you pasted: For VOF it does not work as you have single temperature field and this is defined on mixture level. Moreover the UDMI can only be assigned to mixture thread. Moreover you are looping over the phase domains and source will be overwritten..

Best regards,

Amine

Close