When CFD results from another tool are available, they may be used to initialize a code_saturne
computation using the MEDCoupling remapper tools. For more information on MEDCoupling features, see https://docs.salome-platform.org/latest/dev/MEDCoupling/tutorial/index.html#english-toc
This requires that:
code_saturne
is installed with MEDCouplingIf the previous results are provided in another format than MED, they can be converted using the SALOME platform's PARAVIS module, which is an extension to ParaView including several plugins, especially a MED reader and writer. All that is required is to read the results in PARAVIS, then save them to MED format them using the "Save Data" option from ParaView's "File" menu. This can also be done using ParaView scripts if preferred.
The following example shows how to read fields from a MED file using MEDCoupling remapper features.
The field_names
array here contains the list of fields we plan to read and their matching names in the MED file.
The file_name
should reference a file relative to the run directory, using either a proper relative path or an absolute path (as usual, if the file is placed in a case's DATA directory, it will automatically be copied to the execution directory, but this leads to additional copies of possibly large data).
In this example, we also force the remapper option to PointLocator (see INTERP_KERNEL::PointLocator in MEDCoupling documentation). By default, code_saturne
uses INTERP_KERNEL::Triangulation, which allows for better conservation of quantities, but is slower.
Note that we do not need to specify the field dimensions here, but they should match, so mapping a vector field to a scalar will produce a crash.