Replies: 1 comment
-
Hi, since you are asking about compilation, I presume you want to implement the model in Rust? Here are the steps that get you started after forking the repository. Install rustYou need the rust compiler to build the code. Follow the instructions here. Copy existing equation of state as starting pointEquations of state are rust modules that live inside You can add a so-called feature for your new equation of state rust module using cargo build --features cppcsaft If you can, reuse models/Helmholtz contributions that are already part of FeOs if they are compatible (see for example, StructureThere are two things that you'll have to think about when implementing a model. The calculation of the Helmholtz energy and how to handle its parameters. In our implementations, you'll usually find a An equation of state in FeOs has to implement several interfaces (rust traits). Here you can find the implementation for PC-SAFT. The most important function is the In general, you can structure the implementation of the Helmholtz energy as you wish - e.g. you could put all contributions into a single function. We usually have modules and src/pcsaft
├── eos
│ ├── dispersion.rs # implements dispersive contribution
│ ├── hard_chain.rs # implements hard chain contribution
│ ├── mod.rs. # implements the actual model by collecting the contributions in a struct
│ └── polar.rs # implements polar contributions
├── mod.rs # exports everything needed for the model
└── parameters.rs. # how to handle parameters ParametersYou are completely free in the way you handle model parameters. If you use our implementations as example, you'll find that we assemble parameters from records. You can use this structure as well (it enables deriving some functionalities for automatic JSON parsing) or do a simple implementation first and then come back to these kinds of features later. TestsBefore you expose your implementation to Python, I'd suggest implementing tests for contributions (and possibly intermediate properties needed) in rust. Here is an example for the tests of the PC-SAFT dispersion term where we used values from a prior implementation. Expose equation of state and parameters to PythonOnce everything is implemented and tested, you can expose the equation of state and parameters to Python. This is done by adding your model as variant here. After that, you'll have to define how your parameters and equation of state can be built from Python. This is a very high level view on the steps needed. There are a lot of details I left out in each step - feel free to ask about specific issues as they appear. As said above, I'd start with copying an existing implementation of an equation of state, e.g. If you already have a working/validated implementation in a different programming language, you can point me to it and I mighty be able to provide some support for bringing it over to rust. If there is an implementation, it is also extremely valuable to build tests for small code pieces and implement and test the whole model step by step. Let us know if there any more questions. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What are the step to step procedure to add a new model named cp-pcsaft. How do I compiled it?
Beta Was this translation helpful? Give feedback.
All reactions