Dear Expert,
Can I modify the thermal conductivity equation as I wish in the MFix editor?
How can I modify it for this? Do I have to separate the UDF file (in Fortron) or edit it there,
To edit MFiX source, first “Copy to project directory for editing”. Then make sure to rebuild the solver after you modify the files.
Dear Expert,
If you have any modified calc_k_s.f file then please share me it would be great help me to understand how can i modify this.
I made one thermal conductivity model but this is not compiled, could you tell me what I am wrong?
cal_K_S.f (6.7 KB)
cal_K_G.f (2.4 KB)
What are the specific errors you are seeing? Is there a compilation failure? Why are your files called cal_*
instead of calc_*
? How did you wind up with these file name? Did you click on “Copy to project directory for editing” in the GUI? Please provide more details if you are looking for help.
I click on “Copy to project directory for editing” in the GUI. and add some extra terms in the code. After that, I build a new solver. I run the simulation, simulation is running but I do understand this code is written right, and thermal conductivity will effect the simulation. can I attach this file by UDF function?
The file name should be calc_K_S.f and calc_K_G.f. it is attached below.
calc_K_S.f (6.7 KB)
calc_K_G.f (2.4 KB)
The variable declarations for OMEGA, K_F0, and K_S0
are outside the function k_solid
where they are used.
My suggestion is to code directly in USR_PROP_Kg
and USR_PROP_Ks
subroutines in usr_properties.f
You can take a look at the Absorption column example. You don’t need to fully understand everything, but it has an example of custom solids conductivity in USR_PROP_Ks
Dear Expert,
calc_ks.txt (3.6 KB)
calc_kg.txt (1.9 KB)
I modified the thermal conductivity according to the USR_PROP_Kg
and USR_PROP_Ks
subroutines in usr_properties.f
please check, it is written right or it will work?
is it modified directly “Copy to project directory for editing” in the GUI or add this via UDF function,
Writing or modifying a UDF takes time to understand the data structure of the code, and get familiar with the variables names. It also requires knowledge of Fortran. You may be rushing to write some code, but it will require quite some time before you are comfortable with this. In the meantime, here are some pointers:
- If you want help from the forum, please include your entire setup, not a fragment of a file. Here the
.txt
files you attached are meaningless in the context of MFiX code. This decreases the likelihood of getting an answer from the forum users. - When you modify a UDF, you can build the solver form the GUI (wrench icon). If you have syntax errors, you will get a line number and a message giving you indication of where the error is. It is nearly impossible to test your code as is, but this will not compile due to many syntax errors I cannot go through individually. Maybe you have resources at your institution that could guide you to get more familiar with Fortran programing. This is beyond the scope of the MFiX forum
- A good first step could be to start with the original
usr_properties.f
file and just set a constant value ofK_S(IJK,M)
so you see how the UDF works. Then you can write more code so it becomes a function of other variables. - A common issue when writing code is division by zero. You should always avoid or add a special treatment so division by zero don’t occur. The line
B = 1.25 * ((1.0 - ep_g(IJK)) / ep_g(IJK)) ** (10.0 / 9.0)
will set B to zero when ep_g is one. Then there will be a division by zero when you evaluate A/B
.
Thanks for the suggestion, I’ll start working on it.
I have doubts, you said, to start from usr_properties.f, as I noticed that all the properties are given in the user properties.f then where I have to edit equations in place of calc_ks and calc_kg separately or user_properties.f, only.