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

Wrong cell value for DEFINE_PROFILE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2022, 07:14
Default Wrong cell value for DEFINE_PROFILE
  #1
Member
 
Chris
Join Date: Dec 2020
Posts: 45
Rep Power: 6
Pyrokrates is on a distinguished road
Hi, I´m new to fluent udfs. I tired to implement some input viscous resistance using porous media:



Code:
DEFINE_PROFILE(Darcy_JJ,t,i)
{
    cell_t c;

    real celli[ND_ND]; // Vector with dimensions of present case
    real z;

    real z_in = 8.107e-6; // Length of inlet in z
    real z_pm = 8.107e-6; // Length of porous media in z
    int Nz = 10; // Number of pm cells in z
    real dz = z_pm / Nz; // Length of single filter cell in z

    real Darcy = 3.2268e+13;

    begin_c_loop(c,t)
    {
        C_CENTROID(celli,c,t);
        z = celli[2];

        if(celli[0] == 0 && celli[1] == 0) // Just to check the calculation
        {
            Message("Results for Cell coords: %g %g %g \n",celli[0],celli[1],celli[2]);
            Message("Results for multiplier: %g \n",((z-z_pm-dz/2)/dz + 1));
            Message("Darcy: %g \n", Darcy * ((z-z_pm-dz/2)/dz + 1));
        }

        C_PROFILE(c,t,i) = Darcy * ((z-zPF-dzF/2)/dzF + 1);

        C_UDMI(c,t,0) = C_PROFILE(c,t,i);
    }
    end_c_loop(c,t)
}
And here is my problem... What I expect is that for 10 cells the first cell Center layer in z-direction gets Darcy*1, the second one Darcy*2,... until Darcy*10. What I get is from messages: Exactly what I want, but for the calculation and the output in cfd post a different result. The last cell is something like interpolated meaning I don´t reach the Darcy*10... The resistance starts to decrease over the final cell and not after it... Do you know where the problem is? The first cell is not being interpolated.


Thanks for any help in advance


Chris
Pyrokrates is offline   Reply With Quote

Old   March 31, 2022, 23:27
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Actually I think that's the problem of your contours.

make the picture inside the fluent, turn off "node values" option while making contour.

for the first cell you have gradient from 0 to value -> so picture may look as you expected, but the last cell has value to 0 gradient, so you may see some negative gradient. That's what I expect, didn't see our pictures actually
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
cell center, define profile, udf code


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
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 05:18
Wrong velocities at first cell of velocity inlet boundaries Bahram OpenFOAM Bugs 9 September 24, 2015 11:52
How to locate which cell goes wrong? CjjJoy OpenFOAM Running, Solving & CFD 2 March 22, 2015 21:16
meshing of a compound volume in GMSH shawn3531 OpenFOAM 4 March 12, 2015 11:45
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 13:25


All times are GMT -4. The time now is 11:16.