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

Calculation of F_UDMI by C_UDMI - error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2022, 09:40
Default Calculation of F_UDMI by C_UDMI - error
  #1
Member
 
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 5
Pyrokrates is on a distinguished road
Hey, simple question: I would like to calculate a field magUp and save it with UDM for face and cell.


When I use the following code, everything works perfectly expect the last part for the F_UDMI. The program crashes, when I try to use the "C1" commands. Can you explain this? What am I doing wrong?


Side question: How can I write the part with UgofU... and Up... with the NV_D, NV_DS etc. commands? I run lots of errors trying to do this.


Thanks in advance


Chris





Code:
#include "udf.h"
#include "math.h"

DEFINE_EXECUTE_ON_LOADING(Load_UDM_Up, libname)
{
    Set_User_Memory_Name(0,"Up");
    Message("UDM id 0 reserved for Up.\n");
}

DEFINE_ADJUST(ADJUST_Up,d)
{
    Thread *t;
    cell_t c;
    face_t f;

    real K = 5; // (unit: s)
    real Up_mag;

    thread_loop_c(t,d)
    {
        begin_c_loop(c,t)
        {
            real UgofU = C_U(c,t) * C_U_G(c,t)[0] + C_V(c,t) * C_U_G(c,t)[1] + C_W(c,t) * C_U_G(c,t)[2];
            real VgofV = C_U(c,t) * C_V_G(c,t)[0] + C_V(c,t) * C_V_G(c,t)[1] + C_W(c,t) * C_V_G(c,t)[2];
            real WgofW = C_U(c,t) * C_W_G(c,t)[0] + C_V(c,t) * C_W_G(c,t)[1] + C_W(c,t) * C_W_G(c,t)[2];

            real Up = C_U(c,t) - UgofU * K;
            real Vp = C_V(c,t) - VgofV * K;
            real Wp = C_W(c,t) - WgofW * K;

            Up_mag = sqrt(pow(Up,2) + pow(Vp,2) + pow(Wp,2));

            C_UDMI(c,t,1) = Up_mag;
        }
        end_c_loop(c,t)

        begin_f_loop(f,t)
        {
            if(BOUNDARY_FACE_THREAD_P(t)) // Face is part of boundary field
            {
                F_UDMI(f,t,1) = C_UDMI(F_C0(f,t),F_C0_THREAD(f,t),1);
            }
            else // Face is part of internal field
            {
                F_UDMI(f,t,1) = (C_UDMI(F_C0(f,t),F_C0_THREAD(f,t),1) + C_UDMI(F_C1(f,t),F_C1_THREAD(f,t),1)) / 2;
            }
        }
        end_f_loop(f,t)
    }
}
Pyrokrates is offline   Reply With Quote

Old   February 23, 2023, 13:22
Default
  #2
New Member
 
Join Date: Aug 2019
Posts: 12
Rep Power: 7
lolno is on a distinguished road


connectivity macro of C1 doesnt exist in boundary face thread of a wall
lolno is offline   Reply With Quote

Reply

Tags
define_adjust, f_udmi, udmi


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
Compile calcMassFlowC aurore OpenFOAM Programming & Development 13 March 23, 2018 07:43
Undeclared Identifier Errof UDF SteveGoat Fluent UDF and Scheme Programming 7 October 15, 2014 07:11
Errors in UDF shashank312 Fluent UDF and Scheme Programming 6 May 30, 2013 20:30
CGNS lib and Fortran compiler manaliac Main CFD Forum 2 November 29, 2010 06:25
How to get the max value of the whole field waynezw0618 OpenFOAM Running, Solving & CFD 4 June 17, 2008 05:07


All times are GMT -4. The time now is 18:22.