-
Notifications
You must be signed in to change notification settings - Fork 261
[KratosBio] - Adding Windkessel feature #13448
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
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,138 @@ | |||
import math | |||
import KratosMultiphysics | |||
from KratosMultiphysics.assign_scalar_variable_process import AssignScalarVariableProcess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from KratosMultiphysics.assign_scalar_variable_process import AssignScalarVariableProcess |
I think you don't need this.
@@ -0,0 +1,138 @@ | |||
import math |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import math |
I think you don't need this.
|
||
default_settings = KratosMultiphysics.Parameters(""" | ||
{ | ||
"mesh_id" : 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"mesh_id" : 0, |
This is no longer needed.
"resistance1" : 0.0, | ||
"resistance2" : 0.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"resistance1" : 0.0, | |
"resistance2" : 0.0, | |
"resistance_1" : 0.0, | |
"resistance_2" : 0.0, |
To follow our standard. Besides, if these are not customary ones in de literature (IDK), I'd try to use a more descriptive name for these two values to ease the use.
"compliance" : 0.0, | ||
"venous_pressure" : 0.0, | ||
"initial_pressure" : 0.0, | ||
"pressure_in_mmHg" : true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, I'd suggest a pressure_unit
field that can take string values as Pa
and mmHg
(otherwise an error is thrown). By doing so you leave the room open to extend it to other units if required in the future.
pres_settings = settings.Clone() | ||
pres_settings.RemoveValue("resistance1") | ||
pres_settings.RemoveValue("resistance2") | ||
pres_settings.RemoveValue("compliance") | ||
pres_settings.RemoveValue("initial_pressure") | ||
pres_settings.RemoveValue("venous_pressure") | ||
pres_settings.RemoveValue("echo_level") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is the purpose of pres_settings
? You're using it nowhere.
pres_settings.RemoveValue("echo_level") | ||
|
||
# Create a copy of the PRESSURE settings to set the EXTERNAL_PRESSURE | ||
ext_pres_settings = pres_settings.Clone() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is the purpose of ext_pres_settings
? You're using it nowhere.
for node in self.outlet_model_part.Nodes: | ||
node.Set(KratosMultiphysics.OUTLET, True) | ||
for condition in self.outlet_model_part.Conditions: | ||
condition.Set(KratosMultiphysics.OUTLET, True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the SetFlag
method from the VariableUtils
(it is exported to Python) so these two loops are done in parallel.
print('Current flow rate', self.current_q1) | ||
if self.pressure_in_mmHg: | ||
print('Outlet new pressure:', self.modified_p1/self.conv, " mmHg") | ||
else: | ||
print('Outlet new pressure:', self.modified_p1, " Pa") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the Logger
class for this. Browse for KratosMultiphysics.Logger.PrintInfo
usages to see many examples.
@classmethod | ||
def __GetBlankParameters(cls): | ||
return KratosMultiphysics.Parameters("""{ | ||
"name" : "Processes.KratosMultiphysics.FluidDynamicsBiomedicalApplication.apply_windkessel_outlet_process", | ||
"Parameters" : { | ||
"model_part_name" : "OutletModelPart" | ||
} | ||
}""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is the purpose of these?
@classmethod | ||
def tearDown(self): | ||
KratosUtilities.DeleteFileIfExisting("test_outlet_table.csv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is doing nothing.
@@ -0,0 +1,126 @@ | |||
import csv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import csv |
I think you don't need this.
import KratosMultiphysics | ||
import KratosMultiphysics.KratosUnittest as KratosUnittest | ||
import KratosMultiphysics.kratos_utilities as KratosUtilities | ||
from KratosMultiphysics.FluidDynamicsApplication import apply_outlet_process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from KratosMultiphysics.FluidDynamicsApplication import apply_outlet_process |
I think you don't need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments, mainly related to things that can be removed.
As a comment aside, why don't we make the process in c++ so we can make the nodal loop in parallel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice now! Thanks for taking my comments into consideration.
@AMontanino87 @soudah I think you forgot to merge this. |
The pull request implements the Windkessel boundary conditions adding a process to the FluidDynamicBiomedicalApplication.
Also unit test are provided to check everything is working fine