Skip to content

Conversation

@NiklasVin
Copy link
Collaborator

Main changes of this PR

The parsing procedure of the participant's config files has been adopted to be compatible with the adapter config schema defined here.

Author's checklist

  • I updated the changelog file CHANGELOG.md if there are user-observable changes since the last release.
  • I squashed / am about to squash all commits that should be seen as one.

Reviewers' checklist

  • Does the changelog entry make sense? Is it formatted correctly?
  • Do you understand the code changes?

@NiklasVin NiklasVin requested a review from IshaanDesai December 7, 2025 13:20
@NiklasVin NiklasVin self-assigned this Dec 7, 2025
@NiklasVin
Copy link
Collaborator Author

@uekerman The MetaConfigurator offers a lot of attributes one can define that are not required in the existing tutorials. Which of them need to be supported in the config file to fulfill all requirements of the adapter config schema? From reading the guidelines, I suppose that flip-normal should at least be supported (from R.12)?

@NiklasVin NiklasVin linked an issue Dec 9, 2025 that may be closed by this pull request
@uekerman
Copy link
Member

@uekerman The MetaConfigurator offers a lot of attributes one can define that are not required in the existing tutorials. Which of them need to be supported in the config file to fulfill all requirements of the adapter config schema? From reading the guidelines, I suppose that flip-normal should at least be supported (from R.12)?

There is a difference between ticking R.10 of the guidelines and ticking all required items. Ticking R.10 is IMO enough for the moment. Adding further features can be done in minor releases. Maybe easier to understand: we need all required attributes (only then does the config adhere to the schema).

Something like this should work:

{
  "participant_name": "Fluid",
  "precice_config_file_path": "../precice-config.xml",
  "interfaces": [
    {
      "mesh_name": "Fluid-Mesh",
      "write_data": [
        {
          "name": "Force"
        }
      ],
      "read_data": [
        {
          "name": "Velocity"
        },
        {
          "name": "Temperature"
        }
      ]
    },
    {
      "mesh_name": "Fluid-Upstream-Mesh",
      "write_data": [
        {
          "name": "Heat-Flux"
        }
      ]
    }
  ]
}

Clear enough?

@NiklasVin NiklasVin marked this pull request as ready for review January 25, 2026 10:11
@IshaanDesai IshaanDesai added the usability This issue will make the software easier for non-expert users label Jan 25, 2026
Copy link
Member

@IshaanDesai IshaanDesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add a checking mechanism of the type:

import json
from jsonschema import validate
from jsonschema.exceptions import ValidationError, SchemaError

try:
    with open("precice_adapter_configuration_schema.json", "r") as schema_f:
        schema = json.load(schema_f)
    
    with open("precice-adapter-config.json", "r") as config_f:
        config = json.load(config_f)
    
    validate(instance=config, schema=schema)
    print("Validation successful: The configuration file is valid.")

except ValidationError as ve:
    print(f"Validation error: {ve.message}")
except SchemaError as se:
    print(f"Schema error: {se.message}")
except json.JSONDecodeError as je:
    print(f"Invalid JSON format: {je.msg}")

that checks a user-provided configuration file with the config schema from precice_adapter_configuration_schema.json. How to get the schema file is still an open question. Manually copying over the file is one option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

usability This issue will make the software easier for non-expert users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove _names suffixes from configuration parameters

3 participants