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

Different values for identical UDS and UDM

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2016, 16:03
Default
  #21
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by gaza View Post
Hi Bruno and Farzin,
@Farzin:
I compiled this code:
Code:
#include "udf.h"
DEFINE_EXECUTE_AT_END(myFunc)
{
 Domain *d;
 /* Integrate dissipation. */
    real sum_diss=0.;
    cell_t c;
    face_t f;
    Thread *t;
    const int ID = 11;

    d = Get_Domain(1); /* mixture domain if multiphase */
    thread_loop_c(t,d)
    {
        if (FLUID_THREAD_P(t))
        {
            begin_c_loop(c,t)
                C_UDMI(c,t,0) = C_T(c,t);
            end_c_loop(c,t)
        }
    }
    


    //t = Lookup_Thread(d,ID);
    thread_loop_f(t,d)
    {
        //if (FLUID_THREAD_P(t))
        //if (NNULLP(THREAD_STORAGE(t,SV_UDM_I)))
        
            begin_f_loop(f,t)
                F_UDMI(f,t,0) = F_T(f,t);
            end_f_loop(f,t);
        
        
    }
}
and it gave the: received a fatal signal (Segmentation fault).

@Bruno:
I do not agree with you because I compared data for Static temperature and C_T that was assigned to UDM. Each value was the same but boundary value.
So I agree with Farzin that I have to set face value also with F_T, however I do not know how???

Here mvee wrote that he solved this problem but he unfortunately didn't provide the code:

http://www.cfd-online.com/Forums/flu...g-udm-uds.html
you are using the same number for the C_UDMI and F_UDMI.
The segmentation error usually is regarding some information that is required but isn't available yet (like gradient in the first iteration, for example).

In addition to that, are you comparing your values using node or cell values?
Bruno Machado is offline   Reply With Quote

Old   January 26, 2016, 16:30
Default
  #22
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
I compared node values taken from the line (option node values is picked in the plot menu).
What do you mean saying "you are using the same number for the C_UDMI and F_UDMI"??
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   January 27, 2016, 02:40
Default
  #23
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
Have a look at this post

http://www.cfd-online.com/Forums/flu...tml#post582575

I used another code and compared node and cell values for C_T, UDM and UDS.
There are differences between C_T and UDS and UDM. For UDM and UDS differences occur only at boundary. Why does it occur? How to fix it? Can anybody help?
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   January 20, 2017, 17:00
Default
  #24
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
Farzin,

This might be not completely relevant to the topic.
In my UDF whenever I am having C_UDSI_G in my adjust function, I receive segmentation error. I saw that in this code you are also using that and I am assuming you compiled and ran it without having any error. Is that right?
Did you ever get a segmentation error because of C_UDSI_G?

Thanks,

Ali

Quote:
Originally Posted by FarzinD View Post
One thing I'm suspicious of is that I didn't allocate face values of UDM and the contours are face values indeed.
Here's the related part of the UDF:
Code:
DEFINE_ADJUST(adjust_vorticity_calc,domain)
{
    int n;
    Thread *t,t0,t1;
    cell_t c,c0,c1;
    face_t f;

    //Calculating Vorticity for Cell Centers
    thread_loop_c(t,domain)
    {
        begin_c_loop(c,t)
        {
            C_UDSI(c,t,Vorticity_I) = VORI(c,t);
            C_UDSI(c,t,Vorticity_J) = VORJ(c,t);
            C_UDSI(c,t,Vorticity_K) = VORK(c,t);
        }
        end_c_loop(c,t);
    }

    //Calculating Vorticity Derivatives
    for (n=Vorticity_I; n<Vorticity_I+3; n++)
    {
        uds_derivatives(domain,n);
    }


    thread_loop_c(t,domain)
    {
        begin_c_loop(c,t)
        {
            C_UDMI(c,t,Vorticity_I) = C_UDSI(c,t,Vorticity_I);
            C_UDMI(c,t,Vorticity_J) = C_UDSI(c,t,Vorticity_J);
            C_UDMI(c,t,Vorticity_K) = C_UDSI(c,t,Vorticity_K);
            ND_D(C_UDSI(c,t,G_Vorticity_Ix),C_UDSI(c,t,G_Vorticity_Iy),C_UDSI(c,t,G_Vorticity_Iz),=,\
                C_UDSI_G(c,t,Vorticity_I)[0],C_UDSI_G(c,t,Vorticity_I)[1],C_UDSI_G(c,t,Vorticity_I)[2]);
            ND_D(C_UDSI(c,t,G_Vorticity_Jx),C_UDSI(c,t,G_Vorticity_Jy),C_UDSI(c,t,G_Vorticity_Jz),=,\
                C_UDSI_G(c,t,Vorticity_J)[0],C_UDSI_G(c,t,Vorticity_J)[1],C_UDSI_G(c,t,Vorticity_J)[2]);
            ND_D(C_UDSI(c,t,G_Vorticity_Kx),C_UDSI(c,t,G_Vorticity_Ky),C_UDSI(c,t,G_Vorticity_Kz),=,\
                C_UDSI_G(c,t,Vorticity_K)[0],C_UDSI_G(c,t,Vorticity_K)[1],C_UDSI_G(c,t,Vorticity_K)[2]);
        }
        end_c_loop(c,t);
    }
}



void uds_derivatives(Domain *domain, int n)
{
    MD_Alloc_Storage_Vars(domain, SV_UDSI_RG(n), SV_UDSI_G(n), SV_NULL);
    Scalar_Reconstruction(domain, SV_UDS_I(n), -1, SV_UDSI_RG(n), NULL);
    Scalar_Derivatives(domain, SV_UDS_I(n), -1, SV_UDSI_G(n), SV_UDSI_RG(n), NULL);
    return;
}
alinik is offline   Reply With Quote

Old   January 21, 2017, 00:58
Default
  #25
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
Hi Farzin,
Segmentation error appears when you try to access variable that is not allocated or you perform accessing in wrong manner. Have you set correct values of UDSI? Have you turned on keep memory being free?
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   January 21, 2017, 22:33
Default
  #26
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
Quote:
Originally Posted by gaza View Post
Hi Farzin,
Segmentation error appears when you try to access variable that is not allocated or you perform accessing in wrong manner. Have you set correct values of UDSI? Have you turned on keep memory being free?
Hi Gaza,

I am adjusting a UDM and in that I am using C_UDSI_G.
I get the segmentation error. Any idea how to solve it?

Thanks,
Ali
alinik is offline   Reply With Quote

Old   August 3, 2022, 07:10
Default
  #27
Member
 
sina
Join Date: Nov 2021
Posts: 41
Rep Power: 4
sina_sls is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
you are using the same number for the C_UDMI and F_UDMI.
The segmentation error usually is regarding some information that is required but isn't available yet (like gradient in the first iteration, for example).

In addition to that, are you comparing your values using node or cell values?
Hello,

How can i change UDS boundary value in a Define Adjust UDF? i mean how can i call UDS boundary value to changing in a UDF of Define Adjust?

Regards,
sina_sls is offline   Reply With Quote

Reply

Tags
udf, udm, uds


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
Adjusting UDM to UDS mvee Fluent UDF and Scheme Programming 16 June 26, 2018 04:30
Segmentation violation louiza FLUENT 16 June 27, 2017 15:41
UDS Unsteady with UDM shashank312 FLUENT 3 May 15, 2013 15:35
UDS stored to UDM do not show the same values swati_mohanty FLUENT 0 December 3, 2010 03:46
usage of UDS & UDM Tong FLUENT 2 February 15, 2006 10:32


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