• General

    How to access dictionary values from boundary conditions in OpenFOAM

    OpenFOAMĀ® offers a standard way to access user-specified constant data by means of dictionaries. However, dictionaries are by default read during the start-up phase of the main code. If a boundary condition requires to access the same information, the value can be looked up from the internal database used by OpenFOAM to store objects. The procedure is quite simple, and I show an example below, in a general case. Let’s assume our solver uses the “transportProperties” dictionary, which contains a subdictionary, called “mySubDict”. This sub-dictionary contains a dimensioned scalar, named “myScalar”. In the BC, you can recover “myScalar” as follows: // Extract the dictionary from the database const dictionary& transportProperties…