CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Gradient of species mass fraction

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2020, 17:02
Default
  #21
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
So do you run the case??
Before 1st iteration fluent crashes
mahdi-united is offline   Reply With Quote

Old   March 17, 2020, 17:03
Default
  #22
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
After initializing the case and issuing the command

(rpsetvar 'species/save-gradients? #t)

I could see that the gradients become available under Contours. Look at the attached image.
So
Do you run the case?
After running in 1st iteration fluent crashes
mahdi-united is offline   Reply With Quote

Old   March 18, 2020, 05:51
Default
  #23
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
After initializing the case and issuing the command

(rpsetvar 'species/save-gradients? #t)

I could see that the gradients become available under Contours. Look at the attached image.
my friend
it's amazing
there are many projects of fluent in my computer include multiphase and dpm models
but in the none of multiphase projects by typing the command (rpsetvar ...) species mass fraction gradients doesn't store!!! but
in dpm projects gradients does store!!
why??
mahdi-united is offline   Reply With Quote

Old   March 18, 2020, 05:58
Default The problem
  #24
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
I suppose the problem is not with Fluent or with the cases; it's with what you are doing. In a multiphase-multicomponent phase, gradients of species do not belong to mixture but to the phase. So, while displaying the mass fraction gradient contour, you have to select particular phase in the menu below it. Default selection is mixture representing mixture of phases.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 18, 2020, 08:35
Default
  #25
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
I suppose the problem is not with Fluent or with the cases; it's with what you are doing. In a multiphase-multicomponent phase, gradients of species do not belong to mixture but to the phase. So, while displaying the mass fraction gradient contour, you have to select particular phase in the menu below it. Default selection is mixture representing mixture of phases.
i have changed miltiphase model from VOF to EULERIAN and work fine and gradients sotre well but one question
do i use the eulerian model to solve this problem?
is there anyway to storing gradients in vof model?
mahdi-united is offline   Reply With Quote

Old   March 18, 2020, 10:20
Default Setup
  #26
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
The problem is not with Multiphase model but the way you have setup the phases. Primary phase is a multicomponent mixture but the secondary phase is not. There are no species. You need to have at least two components. Once you have two components, simulation runs alright even after issuing command to save gradients.

Furthermore, you have mesh interface in your case. For such a simple model, interface should not be used. Change it to interior by using Fuse. Go to Mesh > Combine > Fuse and then select both boundaries that you have specified as interfaces. This will convert the interfaces into interior. Interface should only be used if you have a moving mesh in the system. Otherwise, it should not be used.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 18, 2020, 10:54
Default
  #27
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
The problem is not with Multiphase model but the way you have setup the phases. Primary phase is a multicomponent mixture but the secondary phase is not. There are no species. You need to have at least two components. Once you have two components, simulation runs alright even after issuing command to save gradients.

Furthermore, you have mesh interface in your case. For such a simple model, interface should not be used. Change it to interior by using Fuse. Go to Mesh > Combine > Fuse and then select both boundaries that you have specified as interfaces. This will convert the interfaces into interior. Interface should only be used if you have a moving mesh in the system. Otherwise, it should not be used.
thanks a lot

amazing data

i have changed secondary phase from mix-water with one component to water phase without any component and run fine without crashing the fluent and calculation done complete and dmass fraction/dx and etc appear
i am so excited now (((:



now i want to apply this variations with adding udf

hope to solve it too

thank you so much
mahdi-united is offline   Reply With Quote

Old   March 18, 2020, 11:25
Default
  #28
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
The problem is not with Multiphase model but the way you have setup the phases. Primary phase is a multicomponent mixture but the secondary phase is not. There are no species. You need to have at least two components. Once you have two components, simulation runs alright even after issuing command to save gradients.

Furthermore, you have mesh interface in your case. For such a simple model, interface should not be used. Change it to interior by using Fuse. Go to Mesh > Combine > Fuse and then select both boundaries that you have specified as interfaces. This will convert the interfaces into interior. Interface should only be used if you have a moving mesh in the system. Otherwise, it should not be used.
my friend unfortunately case with udf before 1st iteration like before crashes



this is code :




DEFINE_ADJUST(mfgradient, domain)
{
Thread *t;
Thread **pt;
cell_t c;
Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE);
real voidx, voidy, voidz=0.0;

mp_thread_loop_c (t,domain,pt)
{
if (FLUID_THREAD_P(t) && n_udm > 0)
{
begin_c_loop (c,t)
{
C_UDMI(c,t,0) = C_YI_G(c,pt[P_PHASE],0)[0];
}
end_c_loop (c,t)
}
}
}
mahdi-united is offline   Reply With Quote

Old   March 18, 2020, 12:07
Default Command and UDM
  #29
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
There are at least two reasons because of which this could happen. One, you forgot to issue the command to save gradients. Second, you forgot to assign a UDM and initialize it to some value.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 18, 2020, 12:10
Default
  #30
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
There are at least two reasons because of which this could happen. One, you forgot to issue the command to save gradients. Second, you forgot to assign a UDM and initialize it to some value.
no every two case well done
this is complete code:




#include "udf.h"
#include "mem.h"
#include"sg_mem.h"
#include "sg.h"
#include "sg_vof.h"
#include "flow.h"
#include "materials.h"
static real K_q;
static real Y_WV;
static real Y_A;
static real Y_W;
static real RO_A;
static real RO_W;
static real VOF_W;
static real RO_qi;
static real L;
static real m_lg;

/************************************************** *********
UDF to apply mass transfer rate from water to air at the interface
************************************************** **********/


#define MW_W 18.0
#define MW_A 29.0
#define R 8.314
#define pi 3.14159
#define noo_water 1.45e-5 /*kinematic viscosity of water*/
#define noo_air 1e-6 /*kinematic viscosity of air*/





DEFINE_ADJUST(mfgradient, domain)
{
Thread *t;
Thread **pt;
cell_t c;
Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,P_PHASE);
real voidx, voidy, voidz=0.0;

mp_thread_loop_c (t,domain,pt)
{
if (FLUID_THREAD_P(t) && n_udm > 0)
{
begin_c_loop (c,t)
{
C_UDMI(c,t,0) = C_YI_G(c,pt[P_PHASE],0)[0];
}
end_c_loop (c,t)
}
}
}














DEFINE_MASS_TRANSFER(mass_transfer_rate, cell, thread,from_phase_index, from_species_index, to_phase_index, to_species_index)
{
/************ Declare variables *********/

float T_cell, P_cell, P_sat, T_cell_air,T_cell_water;
float u,v,w,Re,D,n_mix,n_vap;
float NV_VEC(G),pos[ND_ND],Z;
float X_WV, Y_A,A;
float NV_MAG ;

Thread *w_liq, *gas_mix, *w_gas,*mix_air,*mix_water,*ft;

int i;
int t_id = 7;


/******** Define variables *********/





m_lg = C_UDMI(cell,thread,0);


//Message("m_lg = %g\n",m_lg);
return (m_lg); /* return value of mass transfer rate */

}
mahdi-united is offline   Reply With Quote

Old   March 18, 2020, 14:27
Default The code
  #31
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
I remember the first part because I wrote it. You do not need voidx, voidy, and voidz because those are not being used. However, for the rest of the code, I am not sure where you picked it from. First of all, m_lg is defined as static and global. This should be a local variable. However badly the code is written it still does not have anything that could cause segmentation violation except one thing; declaration of NV_MAG as float. NV_MAG is a function defined in Fluent that determines magnitude of a vector. You are redefining it as a real variable in your code. This is invalid. Remove that line and do share the output of compilation of the library if the code still does not work.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 19, 2020, 18:21
Default
  #32
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
I remember the first part because I wrote it. You do not need voidx, voidy, and voidz because those are not being used. However, for the rest of the code, I am not sure where you picked it from. First of all, m_lg is defined as static and global. This should be a local variable. However badly the code is written it still does not have anything that could cause segmentation violation except one thing; declaration of NV_MAG as float. NV_MAG is a function defined in Fluent that determines magnitude of a vector. You are redefining it as a real variable in your code. This is invalid. Remove that line and do share the output of compilation of the library if the code still does not work.
hi how are you?
thanks for your helping


this message appear when build the udf


************************************************** ************************** ************************************************** **************************
** WARNING: Automatically switched to run in parallel -t1 mode. **
** Detected non-parallelized UDF usage, enabling parallel usage. **
** If you encounter any issues, please re-run with -t0 flag. **
************************************************** **************************
************************************************** **************************udf_names.c and user_nt.udf files in 3ddp_node are upto date.
(system "copy "D:\ANSYS Inc\v195\fluent"\fluent19.5.0\src\udf\makefile_nt. udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")
Done.




and another point is that after running the value of species gradients is irrational and incorrect!
why??
mahdi-united is offline   Reply With Quote

Old   March 20, 2020, 05:59
Default Gradient
  #33
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
The values for the gradient depend on the field. Until and unless the solution is converged, the gradient would also not be correct.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 20, 2020, 12:28
Default
  #34
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
The values for the gradient depend on the field. Until and unless the solution is converged, the gradient would also not be correct.
The message that wrote in past reply what's the meaning?
Appear after build udf
mahdi-united is offline   Reply With Quote

Old   March 20, 2020, 12:35
Default Not important
  #35
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
All it says is that Fluent has started in parallel and though the UDF source is not parallelized, Fluent will try to use it in a parallel simulation. New versions of Fluent start in parallel even when Serial is selected. To really start Fluent in serial, it needs to be started from command prompt with -t0 argument.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 20, 2020, 12:41
Default
  #36
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
All it says is that Fluent has started in parallel and though the UDF source is not parallelized, Fluent will try to use it in a parallel simulation. New versions of Fluent start in parallel even when Serial is selected. To really start Fluent in serial, it needs to be started from command prompt with -t0 argument.
Is this make problem for runing or incorrect gradients?
mahdi-united is offline   Reply With Quote

Old   March 20, 2020, 12:50
Default Error
  #37
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Yes, it would cause problem if the UDF is not parallelized and you run it in parallel. Try it in Serial.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 20, 2020, 12:58
Default
  #38
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
Yes, it would cause problem if the UDF is not parallelized and you run it in parallel. Try it in Serial.
no. now i select serial and this message appear

in this situation, is this make problem for running?
mahdi-united is offline   Reply With Quote

Old   March 20, 2020, 12:59
Default Serial
  #39
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Please read my previous post carefully. Selecting the Serial on the launcher does NOT start Fluent in serial. To start in serial, you have to start using the command. it is not possible to start Fluent in serial using Fluent launcher.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   March 21, 2020, 14:39
Default
  #40
Senior Member
 
mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 6
mahdi-united is on a distinguished road
Quote:
Originally Posted by vinerm View Post
Please read my previous post carefully. Selecting the Serial on the launcher does NOT start Fluent in serial. To start in serial, you have to start using the command. it is not possible to start Fluent in serial using Fluent launcher.
hi how are you
this is modified code and parallelized it


#include "udf.h"
#include "mem.h"
#include"sg_mem.h"
#include "sg_vof.h"
#include "flow.h"
#include "materials.h"

/************************************************** *********
UDF to apply mass transfer rate from water to air at the interface
************************************************** **********/


DEFINE_ADJUST(adjust_gradient, domain)
{
#if !RP_HOST
Thread *t;
cell_t c;
face_t f;

domain = Get_Domain(2);
thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
C_UDSI(c,t,0) = C_YI_G(c,t,0)[0];
}
end_c_loop (c,t)
}
#endif
}



DEFINE_MASS_TRANSFER(mass_transfer_rate, cell, thread,from_phase_index, from_species_index, to_phase_index, to_species_index)
{
/************ Declare variables *********/
#if !RP_HOST
Thread *mix_air;
real m_lg;

mix_air = THREAD_SUB_THREAD(thread, to_phase_index);


m_lg = C_UDSI(cell,thread,0);


Message("m_lg = %g\n",m_lg);
return (m_lg); /* return value of mass transfer rate */
#endif
}





values of gradients is irrational

some values:


m_lg = -15.3372 m_lg = 13.3316
m_lg = 5.45169
m_lg = 1.16965
m_lg = 0.105699
m_lg = 0.00610973
m_lg = -0.000382168
m_lg = -0.000179512
m_lg = -3.14533e-05
m_lg = 3.46569
m_lg = -15.3372
m_lg = 11.6576
m_lg = -0.275925
m_lg = -0.0847251
m_lg = -0.0133855
m_lg = -0.00144255
m_lg = -0.000119092
m_lg = -7.79091e-06
m_lg = -3.25596e-07
m_lg = 3.46569
m_lg = -15.3372
mahdi-united is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass fraction of species Lilly FLUENT 5 March 13, 2022 18:52
gradient of species mass fraction zhou FLUENT 1 March 14, 2020 08:55
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
UDF for Species Mass Fraction Gradient *IN SPECIFIC ZONE * -- e.g. along axis of sym. ksiegs2 Fluent UDF and Scheme Programming 0 February 27, 2011 13:55
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 22:14


All times are GMT -4. The time now is 13:51.