How are fields and boundaries initialised in CFD?

CFD Direct's OpenFOAM Training fully covers field and boundary initialisation

See Training

Chapter 6 Field and boundary initialisation

This chapter describes the initialisation of fields and the configuration of the field’s boundary conditions. Fields and boundary conditions are specified in field files, e.g. p, U. They are stored in time directories, with the initialised fields almost invariably configured in the 0 directory, corresponding to the start time eqn.

The syntax of field files is introduced in a tutorial example in section 2.1.4 and then described more comprehensively in section 4.2.9 . They include: the dimensions entry for the dimensional units; internalField for the initial internal field values; boundaryField, where the boundary conditions are specified; and, optionally, sources to specify the conditions on fluid that is introduced by a mass or volume source.

This chapter begins with initialisation of the internalField using field functions in section 6.1 . The configuration of sources is then explained in section 6.2 . The rest of the chapter then discusses popular boundary conditions for setting the boundaryField section of field files.

OpenFOAM v14 User Guide - Chapter 6 Field and boundary initialisation
OpenFOAM User Guide