🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Density user defined equation

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

I am learning CFD and I have a problem that has density as a function of Temperature and Pressure.  To start, I wrote a user defined function (usrMyDensity.c) where density is only a function of temperature (linear equation).  I was able to compile the function and call it in my input file, but when i run a simple analysis (internal flow with constant temperature at the walls), i am not able to plot density in FieldView.  I'm assuming that i'm not using the correct problem set up.  

 

I know that it is using the complied user function because initially it was giving me an error of negative density, which i fixed with an if statement in my user function.  

 

Any advice will be greatly appreciated.  

 

thank you for your time and patience  

Unable to find an attachment - read this blog

Find more posts tagged with

Sort by:
1 - 3 of 31
    User: "acupro"
    Altair Employee
    Updated by acupro

    In order to see contours of density, you'll need to request Derived Quantity Output, which is a separate command in the input file.  The default setting is output_frequency = 0, meaning derived quantity output will not be written.  You'll probably want to change that so the output_frequency is the same as you request for Nodal Output.

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    acupro, 

     

    thank you very much, that did it!!!  

     

    I have a followup question regarding compiling C files for a Acusolve user defined function.  if you take a look at the attached doc on my original question (usrMyDensity.c), you'll see that it is a very simple linear equation.  I kept it simple so I could get familiar with compiling user defined functions and calling them in the input file.  However, I now want to create a user defined function that interpolates the density between temperature and pressure.  I wrote a very crude C++ program in Visual Studio to open a .txt file, find pressure and temperatures, and interpolate the density.  I run this file using Visual Studio and it works.  in Visual Studio, to open and read a .txt file, i included fstream.h (#include <fstream>). 

     

    in Acusolve, I want to start by having the user-defined function open the .txt file and read one value (baby steps), but when i try to compile, it is giving me lots of errors.  in the C code, how do I include the fstream.h needed to open and read text files?   

     

    thank you very much

     

    Unable to find an attachment - read this blog

    User: "acupro"
    Altair Employee
    Updated by acupro

    Probably better to contact support at hwsupport@altair.com for those details.  By the way, if you're looking for ideal gas density - a function of absolute temperature and pressure - that is already supported in AcuSolve.