Hi Rob,
Sorry. I realized my mistake with position. I changed it to thread. My updated UDF is
#include "udf.h"
DEFINE_EXECUTE_ON_LOADING(report_version, libudf)
{
Message("\n Hej 5 Reactions Case 1B species \n ");
}
DEFINE_PROFILE(mass_fractions, thread, position)
{
real t = RP_Get_Real("flow-time"); // Get current flow time
real mass_fraction_CO = 0.0; // Initialize mass fraction of CO
real mass_fraction_O2 = 0.0; // Initialize mass fraction of O2
real mass_fraction_H2 = 0.0; // Initialize mass fraction of H2
real mass_fraction_C3H6 = 0.0; // Initialize mass fraction of C3H6
real mass_fraction_NO = 0.0; // Initialize mass fraction of NO
real mass_fraction_CO2 = 0.0; // Initialize mass fraction of CO2
real mass_fraction_NO2 = 0.0; // Initialize mass fraction of NO2
real mass_fraction_H2O = 0.0; // Initialize mass fraction of H2O
real mass_fraction_N2 = 0.0; // Initialize mass fraction of N2
// Define the CO mass fraction schedule
if (t >= 0.0 && t < 10.0) {
mass_fraction_CO = 9.7073e-5; // Constant CO mass fraction at 9.7073e-5 from 0 to 10 seconds
mass_fraction_O2 = 6.6564e-2; // Constant O2 mass fraction at 6.6564e-2 from 0 to 10 seconds
mass_fraction_H2 = 2.2881e-6; // Constant H2 mass fraction at 2.2881e-6 from 0 to 10 seconds
mass_fraction_C3H6 = 5.0963e-4; // Constant C3H6 mass fraction at 5.0963e-4 from 0 to 10 seconds
mass_fraction_NO = 1.5601e-4; // Constant NO mass fraction at 1.5601e-4 from 0 to 10 seconds
mass_fraction_CO2 = 1.5254e-1; // Constant CO2 mass fraction at 0.003130 from 0 to 10 seconds
mass_fraction_NO2 = 0.0; // Constant NO2 mass fraction at 0.0 from 0 to 10 seconds
mass_fraction_H2O = 6.2404e-2; // Constant H2O mass fraction at 6.2404e-2 from 0 to 10 seconds
// Calculate the mass fraction of N2 as the difference
// between 1 and the sum of mass fractions of other species
mass_fraction_N2 = 1.0 - mass_fraction_CO - mass_fraction_O2 -mass_fraction_H2 - mass_fraction_CO2 - mass_fraction_C3H6 - mass_fraction_NO - mass_fraction_NO2 - mass_fraction_H2O;
}
else if (t >= 10.0 && t < 20.0) {
mass_fraction_CO = 1.4561e-4; // CO mass fraction from 10 to 20 seconds
mass_fraction_O2 = 6.6566e-2; // Constant O2 mass fraction from 10 to 20 seconds
mass_fraction_H2 = 4.5764e-6; // Constant H2 mass fraction from 10 to 20 seconds
mass_fraction_C3H6 = 5.0965e-4; // Constant C3H6 mass fraction from 10 to 20 seconds
mass_fraction_NO = 1.5601e-4; // Constant NO mass fraction from 10 to 20 seconds
mass_fraction_CO2 = 1.5255e-1; // Constant CO2 mass fraction from 10 to 20 seconds
mass_fraction_NO2 = 0.0; // Constant NO2 mass fraction from 10 to 20 seconds
mass_fraction_H2O = 6.2406e-2; // Constant H2O mass fraction from 10 to 20 seconds
// Calculate the mass fraction of N2 as the difference
// between 1 and the sum of mass fractions of other species
mass_fraction_N2 = 1.0 - mass_fraction_CO - mass_fraction_O2 -mass_fraction_H2 - mass_fraction_CO2 - mass_fraction_C3H6 - mass_fraction_NO - mass_fraction_NO2 - mass_fraction_H2O;
}
else if (t >= 20.0 && t < 40.0) {
mass_fraction_CO = 9.7073e-5; // Constant CO mass fraction at 9.7073e-5 from 20 to 40 seconds
mass_fraction_O2 = 6.6564e-2; // Constant O2 mass fraction at 6.6564e-2 from 20 to 40 seconds
mass_fraction_H2 = 2.2881e-6; // Constant H2 mass fraction at 2.2881e-6 from 20 to 40 seconds
mass_fraction_C3H6 = 5.0963e-4; // Constant C3H6 mass fraction at 5.0963e-4 from 20 to 40 seconds
mass_fraction_NO = 1.5601e-4; // Constant NO mass fraction at 1.5601e-4 from 20 to 40 seconds
mass_fraction_CO2 = 1.5254e-1; // Constant CO2 mass fraction at 0.003130 from 20 to 40 seconds
mass_fraction_NO2 = 0.0; // Constant NO2 mass fraction at 0.0 from 20 to 40 seconds
mass_fraction_H2O = 6.2404e-2; // Constant H2O mass fraction at 6.2404e-2 from 20 to 40 seconds
// Calculate the mass fraction of N2 as the difference
// between 1 and the sum of mass fractions of other species
mass_fraction_N2 = 1.0 - mass_fraction_CO - mass_fraction_O2 -mass_fraction_H2 - mass_fraction_CO2 - mass_fraction_C3H6 - mass_fraction_NO - mass_fraction_NO2 - mass_fraction_H2O;
}
else if (t >= 40.0 && t < 60.0) {
mass_fraction_CO = 2.9124e-4; // Constant CO mass fraction from 40 to 60 seconds
mass_fraction_O2 = 6.6568e-2; // Constant O2 mass fraction from 40 to 60 seconds
mass_fraction_H2 = 6.9342e-6; // Constant H2 mass fraction from 40 to 60 seconds
mass_fraction_C3H6 = 5.0966e-4; // Constant C3H6 mass fraction from 40 to 60 seconds
mass_fraction_NO = 1.5602e-4; // Constant NO mass fraction from 40 to 60 seconds
mass_fraction_CO2 = 1.5255e-1; // Constant CO2 mass fraction from 40 to 60 seconds
mass_fraction_NO2 = 0.0; // Constant NO2 mass fraction from 40 to 60 seconds
mass_fraction_H2O = 6.2408e-2; // Constant H2O mass fraction from 40 to 60 seconds
// Calculate the mass fraction of N2 as the difference
// between 1 and the sum of mass fractions of other species
mass_fraction_N2 = 1.0 - mass_fraction_CO - mass_fraction_O2 -mass_fraction_H2 - mass_fraction_CO2 - mass_fraction_C3H6 - mass_fraction_NO - mass_fraction_NO2 - mass_fraction_H2O;
}
else if (t >= 60.0 && t < 80.0) {
mass_fraction_CO = 9.7073e-5; // Constant CO mass fraction at 9.7073e-5 from 60 to 80 seconds
mass_fraction_O2 = 6.6564e-2; // Constant O2 mass fraction at 6.6564e-2 from 60 to 80 seconds
mass_fraction_H2 = 2.2881e-6; // Constant H2 mass fraction at 2.2881e-6 from 60 to 80 seconds
mass_fraction_C3H6 = 5.0963e-4; // Constant C3H6 mass fraction at 5.0963e-4 from 60 to 80 seconds
mass_fraction_NO = 1.5601e-4; // Constant NO mass fraction at 1.5601e-4 from 60 to 80 seconds
mass_fraction_CO2 = 1.5254e-1; // Constant CO2 mass fraction at 1.5254e-1 from 60 to 80 seconds
mass_fraction_NO2 = 0.0; // Constant NO2 mass fraction at 0.0 from 40 to 60 seconds
mass_fraction_H2O = 6.2404e-2; // Constant H2O mass fraction at 6.2404e-2 from 60 to 80 seconds
// Calculate the mass fraction of N2 as the difference
// between 1 and the sum of mass fractions of other species
mass_fraction_N2 = 1.0 - mass_fraction_CO - mass_fraction_O2 -mass_fraction_H2 - mass_fraction_CO2 - mass_fraction_C3H6 - mass_fraction_NO - mass_fraction_NO2 - mass_fraction_H2O;
}
else if (t >= 80.0 && t < 90.0){
mass_fraction_CO = 4.8542E-05; // Constant CO mass fraction at 4.8542E-05 from 80 to 90 seconds
mass_fraction_O2 = 6.6571e-2; // Constant O2 mass fraction at 6.6571e-2 from 80 to 90 seconds
mass_fraction_H2 = 1.442e-6; // Constant H2 mass fraction at1.442e-6 from 80 to 90 seconds
mass_fraction_C3H6 = 1.4563e-4; // Constant C3H6 mass fraction at 1.4563e-4 from 80 to 90 seconds
mass_fraction_NO = 1.0402e-4; // Constant NO mass fraction at 1.0402e-4 from 80 to 90 seconds
mass_fraction_CO2 = 1.5256e-1; // Constant CO2 mass fraction at 1.5256e-1 from 80 to 90 seconds
mass_fraction_NO2 = 0.0; // Constant NO2 mass fraction at 0.0 from 80 to 90 seconds
mass_fraction_H2O = 6.2411e-2; // Constant H2O mass fraction at 6.2411e-2 from 80 to 90 seconds
// Calculate the mass fraction of N2 as the difference
// between 1 and the sum of mass fractions of other species
mass_fraction_N2 = 1.0 - mass_fraction_CO - mass_fraction_O2 -mass_fraction_H2 - mass_fraction_CO2 - mass_fraction_C3H6 - mass_fraction_NO - mass_fraction_NO2 - mass_fraction_H2O;
}
// Set the mass fractions at the current position
cell_t c;
face_t f;
begin_f_loop(f, thread)
{
f_loop(c, f);
{
if (VALID_CELL_THREAD_P(c, thread)) {
C_YI(c, thread, 0) = mass_fraction_CO; // Set CO mass fraction
C_YI(c, thread, 1) = mass_fraction_O2; // Set O2 mass fraction
C_YI(c, thread, 2) = mass_fraction_H2; // Set H2 mass fraction
C_YI(c, thread, 3) = mass_fraction_C3H6; // Set C3H6 mass fraction
C_YI(c, thread, 4) = mass_fraction_NO; // Set NO mass fraction
C_YI(c, thread, 5) = mass_fraction_CO2; // Set CO2 mass fraction
C_YI(c, thread, 6) = mass_fraction_NO2; // Set NO2 mass fraction
C_YI(c, thread, 7) = mass_fraction_H2O; // Set H2O mass fraction
C_YI(c, thread, 8) = mass_fraction_N2; // Set N2 mass fraction
}
}
}
end_f_loop(f, thread)
}
But, I get this error instead:
c_sources ['MassFlowUDF.c', 'ReactionUDF.c', 'SpeciesUDF_thread.c', 'TemperatureUDF.c', 'udf_names.c']
c_sources_ ['MassFlowUDF.c', 'ReactionUDF.c', 'SpeciesUDF_thread.c', 'TemperatureUDF.c']
lld-link: error: duplicate symbol: report_version
>>> defined at MassFlowUDF.obj
>>> defined at ReactionUDF.obj
lld-link: error: duplicate symbol: report_version
>>> defined at MassFlowUDF.obj
>>> defined at SpeciesUDF_thread.obj
lld-link: error: duplicate symbol: report_version
>>> defined at MassFlowUDF.obj
>>> defined at TemperatureUDF.obj
scons: *** [libudf.dll] Error 1
The other UDF's have been used with constant mass fraction and work perfetly fine. I dont understand this current error. Can you please help?
Thank you
Pratheeba