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

Function input feature for time-dependent boundary conditions #108

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

kharold23
Copy link
Contributor

Current situation

Closes #89

Release Notes

  • Added a new parameter fn to flow and pressure boundary conditions that takes in a string
  • Interprets the string as a function of time, represented by the variable t
  • The value of the boundary condition is calculated at each time step by evaluating the function at t = the current time value.

Documentation

Time-dependent boundary conditions can now be input using a function passed in as a string. The function is of the variable t, or time. For example:
"bc_values": { "fn": "2.0 * (4*atan(1.)) * COS(2.0 * (4*atan(1.)) * t)" }

Testing

Test case test_time_dependent_block added to test_io.py, which runs json files timeDep_Flow.json and timeDep_Pressure.json.

Code of Conduct & Contributing Guidelines

Initial implementation of a time-dependent flow BC from an expression string. Currently results in a SEGFAULT.
Finished debugging time-dependent flow block
@ktbolt
Copy link
Contributor

ktbolt commented May 29, 2024

I ran the pulsatileFlow_CStenosis_steadyPressure case on Ubuntu 22 and got the following exception

terminate called after throwing an instance of 'std::runtime_error'
  what():  Maximum number of non-linear iterations reached.

You need to add catching exceptions in the Python testing code.


parser_t parser;

parser.compile(expression_string, expression);
Copy link
Contributor

Choose a reason for hiding this comment

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

It is very easy for a user to add an incorrect math expression so you need to have a try/catch here and also throw an exception if parser.compile() returns false.

@ktbolt
Copy link
Contributor

ktbolt commented May 30, 2024

We don't want to mix external software with our source code so the exprtk.hpp file should not be in svZeroDSolver/src/. We need to add a ThirdParty directory and put the exprtk.hpp file in a sub-directory of it.

@ktbolt
Copy link
Contributor

ktbolt commented May 30, 2024

Also I see that there is Docker container file in svZeroDSolver/container/profiling for Ubuntu 22, you can use this to test I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow flow and pressure blocks to take time-dependent functions
2 participants