Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use an OpenFOAM dictionary for configuration #30

Closed
MakisH opened this issue Oct 4, 2018 · 4 comments
Closed

Use an OpenFOAM dictionary for configuration #30

MakisH opened this issue Oct 4, 2018 · 4 comments
Labels
dev Not directly affecting users, but helping future development enhancement Nice to have, but not a problem

Comments

@MakisH
Copy link
Member

MakisH commented Oct 4, 2018

We currently use yaml-cpp to parse our precice-adapter-config.yml YAML file (see more in our wiki)

Although YAML is a nice language to use for configuration files, there are some problems:

  • yaml-cpp is an additional, not so common dependency
  • the yaml-cpp version may conflict with the Boost version (see again this issue)
  • it is a format foreign to OpenFOAM (although this could also be seen as an advantage)

Therefore, it would be good to allow configuring the adapter through a dictionary. This could be done alongside or instead our current YAML-based file.

@MakisH MakisH added the enhancement Nice to have, but not a problem label Oct 4, 2018
@MakisH MakisH added the dev Not directly affecting users, but helping future development label Dec 26, 2018
@MakisH
Copy link
Member Author

MakisH commented Jan 16, 2019

In this context, we should also include an additional option for the kind of each couplingDataUser.

Currently, we use the name (e.g. Forces0) to extract the kind (Force). If one uses e.g. forces (lowercase "f"), this breaks.

Thanks to @davidscn for reporting a relevant problem.

@MakisH
Copy link
Member Author

MakisH commented Jul 24, 2019

A few weeks back I made some progress on this. The latest work-in-progress state can be found in the branch config-dict.

I am currently stuck in transforming the nested lists logic of YAML to dictionaries. For example:

interfaces:
    - mesh: Solid-to-Inner-Fluid
      patch: inner-interface
      read-data: [Sink-Temperature-Inner-Fluid, Heat-Transfer-Coefficient-Inner-Fluid]
      write-data: [Sink-Temperature-Solid, Heat-Transfer-Coefficient-Solid]
    - mesh: Solid-to-Outer-Fluid
      patch: outer-interface
      read-data: [Sink-Temperature-Outer-Fluid, Heat-Transfer-Coefficient-Outer-Fluid]
      write-data: [Sink-Temperature-Solid, Heat-Transfer-Coefficient-Solid]

This example is from the heat exchanger tutorial (for CalculiX, but the logic is the same).

What I originally wanted to do was represent this as a list of dictionaries. This could be quite tricky and a better idea (@olesenm) would be to have these dictionaries unconnected to each other and then get them from the table of contents. But I still have have not tried to implement this.

@olesenm
Copy link
Contributor

olesenm commented Jul 26, 2019

To clarify, a list of dictionaries isn't intrinsically more difficult. You can either read them as an entry (see https://develop.openfoam.com/Development/OpenFOAM-plus/blob/master/src/OpenFOAM/db/dictionary/dictionaryListEntry/dictionaryListEntry.H) and them loop over them. Another way is to have the same syntax and use that entry to create a PtrList of your interfacing objects. Finally can just have them as a collection of subdicts (as discussed).

One advantage of the collection of subdicts is that you will able to use changeDictionary to rewrite/modify the entries. If they are a list (with the '(...)' delimiters) they are locked away from easy dictionary manipulation.
On the other side, if you handle them as a PtrList, the meaning of the keywords are more easily handled by the interfacing object (construct from dictionary).

Probably worth the effort to combine both. Have subdicts, but pass off them each off to a construct from dictionary and save as a PtrList.

@MakisH
Copy link
Member Author

MakisH commented Mar 2, 2020

This was closed with #105.

@MakisH MakisH closed this as completed Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Not directly affecting users, but helping future development enhancement Nice to have, but not a problem
Projects
None yet
Development

No branches or pull requests

2 participants