writing UDF in AcuSolve

Junta_20361
Junta_20361 New Altair Community Member
edited August 2023 in Community Q&A

Hello expert,

I'm working on a simulation where the material is a mixture of N2, Co2 & O2.

I use species transport function to define the gas mixture.

Now, the viscosity and density of this mixture will be calculated by UDF with below equation:

Gas_vis = VisO2 * specO2 + VisCo2 * specCo2 + VisN2 * (1 - specO2 - specCo2)

where VisO2, Co2, N2 are user input values; specO2 & specCo2 are species data at each elems, provide by acusolve udf.

To be honest, i don't have much experience in this domain and having trouble defining specO2 and specCo2.
Below is my definition of specO2 & specCo2:
image

When compiling, acusolve notified there are errors at line 50 & 51.
Could you help me check & modify it for me?

Attached is my full udf.

Thanks in advance!

Answers

  • acupro
    acupro
    Altair Employee
    edited November 2020

    Can we assume here that your are indicating num_species = 2 in the EQUATION command?

    Can we also assume:

        If  species_1 = 0 and species_2 = 0; the properties should be that of N2
        If  species_1 = 1 and species_2 = 0; the properties should be that of O2
        If  species_1 = 0 and species_2 = 1; the properties should be that of Co2

    Thank you.

  • Junta_20361
    Junta_20361 New Altair Community Member
    edited November 2020

    Can we assume here that your are indicating num_species = 2 in the EQUATION command?

    Can we also assume:

        If  species_1 = 0 and species_2 = 0; the properties should be that of N2
        If  species_1 = 1 and species_2 = 0; the properties should be that of O2
        If  species_1 = 0 and species_2 = 1; the properties should be that of Co2

    Thank you.

    Hi acupro,

    Thanks for your response.

    1. I defined num-species = 2, which are CO2 and O2. I consider the N2 is the background.

    2. "   If  species_1 = 0 and species_2 = 0; the properties should be that of N2
        If  species_1 = 1 and species_2 = 0; the properties should be that of O2
        If  species_1 = 0 and species_2 = 1; the properties should be that of Co2"

    yes, it is the same as by expression.

  • acupro
    acupro
    Altair Employee
    edited November 2020

    Please try the attached udf.  Make sure you enable DERIVED_QUANTITY_OUTPUT at the same frequency as NODAL_OUTPUT so you can make sure the resultant viscosity is as you desire, based on the species results.

  • Junta_20361
    Junta_20361 New Altair Community Member
    edited November 2020

    Please try the attached udf.  Make sure you enable DERIVED_QUANTITY_OUTPUT at the same frequency as NODAL_OUTPUT so you can make sure the resultant viscosity is as you desire, based on the species results.

    hi acupro,

    Very nice!

    Thanks for your great help!

  • Gamal2023
    Gamal2023 Altair Community Member
    edited August 2023

    Hi Junta, 
    Hi Acupro

    I wan to simulate H2S dispersion in atmosphere. I am a new to CFD in general and Acusolve in particular. I would request your assistance to active species in Acusolve 2022.3, and defien gas mixture properties. Which physical model to implement in acusolve to study H2S dispersion and predict its concentration at certain points of interest.

    I hope you can assist and guide me through out my project

  • acupro
    acupro
    Altair Employee
    edited August 2023
    Gamal2023 said:

    Hi Junta, 
    Hi Acupro

    I wan to simulate H2S dispersion in atmosphere. I am a new to CFD in general and Acusolve in particular. I would request your assistance to active species in Acusolve 2022.3, and defien gas mixture properties. Which physical model to implement in acusolve to study H2S dispersion and predict its concentration at certain points of interest.

    I hope you can assist and guide me through out my project

    Posted a response on the other, similar conversation.