{"id":26005404,"url":"https://github.com/precice/febio-adapter","last_synced_at":"2025-03-05T20:53:54.153Z","repository":{"id":50666967,"uuid":"518814142","full_name":"precice/febio-adapter","owner":"precice","description":"preCICE-adapter for the software tool FEBio (currently experimental)","archived":false,"fork":false,"pushed_at":"2023-06-21T09:25:52.000Z","size":100,"stargazers_count":2,"open_issues_count":4,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-03-26T07:17:09.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/precice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-28T11:14:05.000Z","updated_at":"2024-03-26T07:17:09.972Z","dependencies_parsed_at":"2022-08-25T21:50:37.476Z","dependency_job_id":null,"html_url":"https://github.com/precice/febio-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/precice%2Ffebio-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/precice%2Ffebio-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/precice%2Ffebio-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/precice%2Ffebio-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/precice","download_url":"https://codeload.github.com/precice/febio-adapter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242103974,"owners_count":20072369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-05T20:53:53.154Z","updated_at":"2025-03-05T20:53:54.141Z","avatar_url":"https://github.com/precice.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FEBio-preCICE adapter\n\n**experimental** preCICE-adapter for the software tool [FEBio](https://github.com/febiosoftware/FEBio).\n\nThe FEBio-preCICE adapter is a preCICE adapter for [FEBio](https://github.com/febiosoftware/FEBio). It allows to exchange data on `FEMaterialPoints`  via preCICE. What data and to which preCICE variable is configured via a JSON file (see example file `febio-config.json` below). For an easy setup use the provided `.so` file, or follow the build step to compile it for your platform. The adapter allows to exchange data on `FEMaterialPoints` with other solvers. The adapter is configured using a JSON file.\n\nDesign and development of this adapter is described in detail in the [Master thesis of Fritz Otlinghaus](http://dx.doi.org/10.18419/opus-12291).\n\n## Required Dependencies\n\nThe following dependencies are required:\n\n- [preCICE](https://precice.org/installation-overview.html)\n- [rttr](https://www.rttr.org/)\n\n## Building the adapter\n\nFor quick use, we provide a x86 shared library as download option. This `.so` file requires all the dependencies mentioned above. If you want to build the adapter yourself, checkout the FEBio repository and go to the branch of the version you want to build against. Set the cmake variable `FEBio_LIB_DIR` to this dir, as we need the include files to compile this plugin.\nThen run:\n\n```bash\ncmake\nmake\n```\n\nNow there is a `libFEBioPreciceAdapter.so` in your cmake output folder. This is the file you need to refer to in your `febio.xml`.\n\n## Using the adapter\n\nCreate a `febio.xml`\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"ISO-8859-1\"?\u003e\n\u003cfebio_config version=\"3.0\"\u003e\n        \u003cdefault_linear_solver type=\"pardiso\"\u003e\u003c/default_linear_solver\u003e\n        \u003cimport\u003e$pathToThePluginFile/libFEBioPreciceAdapter.so\u003c/import\u003e\n\u003c/febio_config\u003e\n```\n\nin your model folder.\nAdd the following sinppet to your `your_input_file.feb`  right below the Module section.\n\n```xml\n        \u003cCode\u003e\n                \u003ccallback name=\"precice_callback\"/\u003e\n        \u003c/Code\u003e\n```\n\nAdd a preCICE config file and create a `febio-config.json` with the options below\nThan call febio with `febio3 -cnf ./febio.xml you_input_file.feb`\n\n### Configuration options\n\nAll attributes are contained in the `coupling_params` dict. The attributes are:\n\n| Key | Possible Values | Description |\n| --- | --- | --- |\n| `element_set_to_couple` |  | Name of the element set that should be coupled via preCICE. Can be found in the febio input file. |\n| `participant_name`  |  | Name of the preCICE participant of FEBio |\n| `config_file_name`  |  |  Path to the preCICE configuration file  |\n| `read_mesh_name` |  | Name of the mesh to read from |\n| `read_data_name` |  | dict, see below |\n| `write_mesh_name` |  | name of the mesh to write to |\n| `write_data_name` |  | dict, see below |\n\n#### write/read_data_name options\n\nThe adapter can read and write various data to and from FEBio. Possible data that can be handled are:\n\n| Key | Possible Values | Description |\n| --- | --- | --- |\n| `type` | `function` `variable` | type of attribute for the FEMaterialPoint that is read or written. |\n| `class_type` | `materialPoint` | This option sets what class type is accessed in FEBio, in future the possiblity of a `FEMaterial` or something like it could be added. |\n| `febio_class_name` |  | Class name of the object that is being manipulated in FEBio e.g `FEFluidMaterialPoint` |\n| `name` |  | Name of the attribute that is written/read `Vext` |\n| `febio_type` | `vec3d` `vec2d` `double` `int` `float` `vector\u003cdobule\u003e` | data type of attribute being write/read |\n| `mapping_name` |  | Name of data point in preCICE |\n| `precice_type` | `scalar` `vector` | type of data point in precice |\n\n### Example configuration\n\n```json\n{\n   \"coupling_params\": {\n      \"element_set_to_couple\": \"Part1\",\n      \"participant_name\": \"FEBio\",\n      \"config_file_name\": \"../precice-config.xml\",\n      \"read_mesh_name\": \"FEBioMesh\",\n      \"read_data_name\": [\n         {\"type\": \"function\", \"febio_class_name\": \"FESolutesMaterialPointTPM\", \"name\": \"set_concentrations\", \"mapping_name\": \"apap_ext'\", \"febio_type\": \"double\", \"precice_type\": \"scalar\"},\n         {\"type\": \"function\", \"febio_class_name\": \"FESolutesMaterialPointTPM\", \"name\": \"set_concentrations_tangents\", \"mapping_name\":  \"d_vapap_ext__d_apap_ext\", \"febio_type\": \"double\", \"precice_type\": \"scalar\"}\n      ],\n      \"write_mesh_name\": \"FEBioMesh\",\n      \"write_data_name\": [\n         {\"type\": \"function\", \"class_type\": \"materialPoint\", \"febio_class_name\": \"FESolutesMaterialPointTPM\", \"name\": \"Vext\", \"mapping_name\": \"Vext\", \"febio_type\": \"double\", \"precice_type\": \"scalar\"},\n         {\"type\": \"function\", \"class_type\": \"materialPoint\", \"febio_class_name\": \"FESolutesMaterialPointTPM\", \"name\": \"GetViFat\", \"mapping_name\": \"Vli_fat\", \"febio_type\": \"double\", \"precice_type\": \"scalar\"},\n         {\"type\": \"variable\", \"class_type\": \"materialPoint\", \"febio_class_name\": \"FEBiphasicMaterialPointTPM\", \"name\": \"m_phi0\", \"mapping_name\": \"Vli_nofat\", \"febio_type\": \"double\", \"precice_type\": \"scalar\"},\n         {\"type\": \"function\", \"class_type\": \"materialPoint\", \"febio_class_name\": \"FESolutesMaterialPointTPM\", \"name\": \"GetCyp2e1\", \"mapping_name\": \"cyp2e1\", \"febio_type\": \"double\", \"precice_type\": \"scalar\"},\n         {\"type\": \"variable\", \"class_type\": \"materialPoint\", \"febio_class_name\": \"FESolutesMaterialPointTPM\", \"name\": \"m_ca\", \"mapping_name\": \"apap_ext\", \"febio_type\": \"vector\u003cdouble\u003e\", \"precice_type\": \"scalar\"}\n      ]\n   }\n}\n```\n\n### Registering classes and generate.py\n\nAs we use reflection for the MaterialPoints, one has to register custom MaterialPoint classes with the plugin in `FEBioReflection.cpp` and extend two if statments. These statments are in `PreciceCallback::insertData` and `PreciceCallback::extractData`.\n\nWe added a `generate.py` that searches all subclasses of `FEMaterialPoint` in the current directory (your FEBio dir) and writes the needed code snippets to four files `FEBioReflection.cpp`, `includes` `insertData` and `extractData`. The `FEBioReflection.cpp` can directly be copied over the other three files need to be manually integrated into the `PreciceCallback.cpp`\nTo use `generate.py` you need to add the C++ header files to the include path\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprecice%2Ffebio-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprecice%2Ffebio-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprecice%2Ffebio-adapter/lists"}