From 74ecbaa41b9d9418cd23b2ff58ea5e26f8b9d579 Mon Sep 17 00:00:00 2001 From: TS-CUBED Date: Sat, 23 Jul 2022 12:45:34 +0100 Subject: [PATCH 1/5] Use physiological parameters, incl. toggle for physUnits and SI --- haemoPimpleFoam/WKFunctions.C | 19 ++++++++++++----- .../{0 => constant}/windkesselProperties | 21 +++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) rename tutorial_cases/carotid_transient_coarse_tet/{0 => constant}/windkesselProperties (80%) diff --git a/haemoPimpleFoam/WKFunctions.C b/haemoPimpleFoam/WKFunctions.C index 5764320..d19c274 100644 --- a/haemoPimpleFoam/WKFunctions.C +++ b/haemoPimpleFoam/WKFunctions.C @@ -20,6 +20,7 @@ typedef struct double R; /* Resistance */ double C; /* Compliance */ double Z; /* Impedance */ + bool physUnits; /* Physiological or SI units for R, C, Z */ int order; double time; // store time in windkessel struct to reset values // should the time step be run multiple times @@ -51,6 +52,7 @@ void initialise(const dictionary& windkesselProperties) scalar C = readScalar(subDict.lookup("C")); scalar R = readScalar(subDict.lookup("R")); scalar Z = readScalar(subDict.lookup("Z")); + bool physUnits = readBool(subDict.lookup("physiologicalUnits")); scalar real_index = readScalar(subDict.lookup("outIndex")); scalar Qpre1 = readScalar(subDict.lookup("Flowrate_oneStepBefore")); scalar Qpre2 = readScalar(subDict.lookup("Flowrate_twoStepBefore")); @@ -64,11 +66,21 @@ void initialise(const dictionary& windkesselProperties) int order = FDMorder; - Info << "C, R, Z and index are " << C << ", " << R << ", " << Z << ", " << out_index << "." < 0: 80.01, -1: 80.00, -2: 79.99, -3: 79.98*/ + if (physUnits == true) + { + R = R * 133.322365e6; + Z = Z * 133.322365e6; + C = C * 1e-6 / 133.322365; + Info << "Converting C, R, Z from physioligical units to SI units!"; + } + + Info << "C, R, Z and index are " << C << ", " << R << ", " << Z << ", " << out_index << "." < Date: Sat, 23 Jul 2022 14:03:31 +0100 Subject: [PATCH 4/5] Fix WSS functionObjects --- .../system/controlDict | 69 ++++++++++++++++--- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/tutorial_cases/carotid_transient_coarse_tet/system/controlDict b/tutorial_cases/carotid_transient_coarse_tet/system/controlDict index 90b849c..f838308 100644 --- a/tutorial_cases/carotid_transient_coarse_tet/system/controlDict +++ b/tutorial_cases/carotid_transient_coarse_tet/system/controlDict @@ -79,14 +79,14 @@ functions writeControl outputTime; } - Mag + wallShearStressMag { // Mandatory entries (unmodifiable) type mag; libs (fieldFunctionObjects); // Mandatory (inherited) entries (runtime modifiable) - field U; // wallShearStress; + field wallShearStress; // Optional (inherited) entries result wallShearStressMag; @@ -101,7 +101,64 @@ functions writeInterval 1; } - //#include "surfaces" + averagesWALL + { + type surfaceFieldValue; + libs ("libfieldFunctionObjects.so"); + writeControl timeStep; + log yes; + writeFields no; + regionType patch; + name WALL; + operation average; + // operation weightedAverage; + // weightField phi; + + fields + ( + wallShearStress + wallShearStressMag + ); + } + averagesAPEX + { + type surfaceFieldValue; + libs ("libfieldFunctionObjects.so"); + writeControl timeStep; + log yes; + writeFields no; + regionType patch; + name APEX; + operation average; + // operation weightedAverage; + // weightField phi; + + fields + ( + wallShearStress + wallShearStressMag + ); + } + averagesSINUS + { + type surfaceFieldValue; + libs ("libfieldFunctionObjects.so"); + writeControl timeStep; + log yes; + writeFields no; + regionType patch; + name SINUS; + operation average; + // operation weightedAverage; + // weightField phi; + + fields + ( + wallShearStress + wallShearStressMag + ); + } + averagesCCA { type surfaceFieldValue; @@ -120,8 +177,6 @@ functions p U H - wallShearStress - wallShearStressMag ); } averagesICA @@ -142,8 +197,6 @@ functions p U H - wallShearStress - wallShearStressMag ); } averagesECA @@ -164,8 +217,6 @@ functions p U H - wallShearStress - wallShearStressMag ); } From 31e64ccc2ac4c782227d88dea4026f76de030020 Mon Sep 17 00:00:00 2001 From: TS-CUBED Date: Sat, 23 Jul 2022 14:48:48 +0100 Subject: [PATCH 5/5] Rearrange Z, C, R to match 3EWK order (avoid confusion) --- haemoPimpleFoam/WKFunctions.C | 12 ++++++------ .../constant/windkesselProperties | 11 +++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/haemoPimpleFoam/WKFunctions.C b/haemoPimpleFoam/WKFunctions.C index d19c274..0d48d00 100644 --- a/haemoPimpleFoam/WKFunctions.C +++ b/haemoPimpleFoam/WKFunctions.C @@ -49,9 +49,9 @@ void initialise(const dictionary& windkesselProperties) const dictionary& subDict = windkesselProperties.subDict(outletName); + scalar Z = readScalar(subDict.lookup("Z")); scalar C = readScalar(subDict.lookup("C")); scalar R = readScalar(subDict.lookup("R")); - scalar Z = readScalar(subDict.lookup("Z")); bool physUnits = readBool(subDict.lookup("physiologicalUnits")); scalar real_index = readScalar(subDict.lookup("outIndex")); scalar Qpre1 = readScalar(subDict.lookup("Flowrate_oneStepBefore")); @@ -69,17 +69,17 @@ void initialise(const dictionary& windkesselProperties) /* e.g., last saved time: 80.00, running from 80.01 ---> 0: 80.01, -1: 80.00, -2: 79.99, -3: 79.98*/ if (physUnits == true) { - R = R * 133.322365e6; Z = Z * 133.322365e6; C = C * 1e-6 / 133.322365; - Info << "Converting C, R, Z from physioligical units to SI units!"; + R = R * 133.322365e6; + Info << "Converting Z, C, R from physioligical units to SI units!" <