I am studying the codes in ‘.f’ files, finding that not all of the variables are defined before they are called or assigned. So, how to find the defination of a variable that is not defined in the present ‘.f’ files?
I am sorry. My question is unclear. I am learning code files that may be related to my topic in order to have more detailed knowledge about the operating mechanism. For example, the file named calc_force_dem_mod.f is one of a module I am interested in. There are many private and shared variables listed in this file. Among them, the private variables are specified together with annotations; however, the shared variables could not be directly understood in the present file because they may be claimed in another files.
(1) For instance, a variable OPTFLAG1 is mentioned but it is hard to find its annotation in calc_force_dem_mod.f, which makes the meaning of OPTFLAG1 hard to be caught.
(2) Similarly, what is the meaning of MAX_PIP_EXIST and why there is another variable called MAX_PIP?
(3) I guess FCHAIN_MIDPOINT refers to the midpoint of a force chain and might be defined in the form of ‘FCHAIN_MIDPOINT(:)’, yet it is ‘FCHAIN_MIDPOINT(:,:)’. So, I would like to get more information about ‘FCHAIN_MIDPOINT(:,:)’.
I am not sure whether a kind of function exists to help searching hundreds of .f files.
Hi. The built-in editor in the MFiX GUI is not (yet) a full development environment with features like “find symbol definition” (this would be a great feature and we may add it in a future version).
There are a few things you can do:
You can go to an Anaconda prompt, go to the MFiX source directory, and use grep to search:
grep -ir fchain_midpoint
the -i flag says to ignore case, and the -r makes it search recursively through subdirectories. This will find all mentions of the symbol, not just the definition. The definition is often, but not always, in a file called something like init_namelist.f
Note that some, but not all, of these variables are MFiX “keywords”, which can be set in the .mfx file. (The rest of the variables are just internal variables).
If the variable is a keyword, it will have additional documentation around it in the form of XML tags, for example optflag1:
The text in the “description” field goes into the documentation: here
For my development work, I use Emacs which supports a feature called “tags”, other editors like Vim support this too. Emacs is not easy to learn, however. You may find some other development environment easier to use, perhaps Visual Studio if you are on Windows.