CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Windkessel boundary implementation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 7, 2024, 12:04
Default Windkessel boundary implementation
  #1
New Member
 
Filippo
Join Date: Mar 2023
Posts: 1
Rep Power: 0
Filippo70 is on a distinguished road
Hi foamers

I simulated the flow through a thoracic aorta with a modify pimple, in particular pimpleWKFoam:
Openfoam solver for Windkessel boundary conditions


Now i want to simulate fluid-structure interaction with solids4Foam, so i want to implement a three-element Windkessel boundary condition that is more simple to use for this scope.
In my.C file, I have to utilize 'phi' to compute the flux and estimate the new pressure value from the equation:(1+\frac{Z}{R})*Q+C*Z*\frac{dQ}{dt}=\frac{P}{R}+C*\frac{dP}{dt}
where 'P' is the pressure, 'Q' the flow rate, Z, R and C is the equivalent of impedance, resistance and capacity.


Following this brief introduction, the question is whether it is possible to calculate 'phi' from the previous time-step directly from the boundary using this code?:
Code:
       

const fvsPatchField<scalar>& phi_old =
        db().lookupObject<surfaceScalarField>
        (
            phiName_
        ).oldTime().boundaryField()[patch().index()];
I could not find any existing boundary codition that calculates the ‘phi’ of the previous time step.


If I check the flux out of my boundary with some 'Info' and compare it to the output of pimpleFoam (adjusted with certain information), I get this for the first time-step:
Time = 1e-06

PIMPLE: iteration 1
smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 4.456366458e-05, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 4.481724285e-05, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 1, Final residual = 4.495236994e-05, No Iterations 1
Boundary patch: inlet - Phi = -2.788e-05
Boundary patch: inlet - Phi_old = -2.788e-05
Boundary patch: outlet - Phi = 0
Boundary patch: outlet - Phi_old = 0
Boundary patch: outlet_LSA - Phi = 0
Boundary patch: outlet_LSA - Phi_old = 0
Boundary patch: outlet_LCCA - Phi = 0
Boundary patch: outlet_LCCA - Phi_old = 0
Boundary patch: outlet_RCCA - Phi = 0
Boundary patch: outlet_RCCA - Phi_old = 0
Boundary patch: outlet_RSA - Phi = 0
Boundary patch: outlet_RSA - Phi_old = 0
Boundary patch: walls - Phi = 0
Boundary patch: walls - Phi_old = 0
outlet n. =0 pressureNew = 0 pressure_tm1 = 0
impedence Z =91300000resistence R 30300000compliance C 1.74e-08
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =2 pressureNew = 0 pressure_tm1 = 0
impedence Z =524000000resistence R 174000000compliance C 3.04e-09
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =1 pressureNew = 0 pressure_tm1 = 0
impedence Z =658000000resistence R 218000000compliance C 2.42e-09
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =3 pressureNew = 0 pressure_tm1 = 0
impedence Z =514000000resistence R 171000000compliance C 3.09e-09
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =4 pressureNew = 0 pressure_tm1 = 0
impedence Z =398000000resistence R 132000000compliance C 4e-09
volFlowRate =0 volFlowRate_tm1 = 0
GAMG: Solving for p, Initial residual = 1, Final residual = 4.664607714e-07, No Iterations 48
outlet n. =0 pressureNew = 0 pressure_tm1 = 0
impedence Z =91300000resistence R 30300000compliance C 1.74e-08
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =2 pressureNew = 0 pressure_tm1 = 0
impedence Z =524000000resistence R 174000000compliance C 3.04e-09
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =1 pressureNew = 0 pressure_tm1 = 0
impedence Z =658000000resistence R 218000000compliance C 2.42e-09
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =3 pressureNew = 0 pressure_tm1 = 0
impedence Z =514000000resistence R 171000000compliance C 3.09e-09
volFlowRate =0 volFlowRate_tm1 = 0
outlet n. =4 pressureNew = 0 pressure_tm1 = 0
impedence Z =398000000resistence R 132000000compliance C 4e-09
volFlowRate =0 volFlowRate_tm1 = 0
time step continuity errors : sum local = 9.572685965e-14, global = -8.626285041e-15, cumulative = -8.626285041e-15
PIMPLE: iteration 2
smoothSolver: Solving for Ux, Initial residual = 4.955976818e-05, Final residual = 9.553384395e-09, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 4.613423638e-05, Final residual = 6.685566471e-09, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 4.299007742e-05, Final residual = 6.516350192e-09, No Iterations 1
Boundary patch: inlet - Phi = -2.788074286e-05
Boundary patch: inlet - Phi_old = -2.788e-05
Boundary patch: outlet - Phi = 8.783959471e-06
Boundary patch: outlet - Phi_old = 0
Boundary patch: outlet_LSA - Phi = 5.742673988e-06
Boundary patch: outlet_LSA - Phi_old = 0
Boundary patch: outlet_LCCA - Phi = 3.60309519e-06
Boundary patch: outlet_LCCA - Phi_old = 0
Boundary patch: outlet_RCCA - Phi = 3.535694883e-06
Boundary patch: outlet_RCCA - Phi_old = 0
Boundary patch: outlet_RSA - Phi = 6.215318152e-06
Boundary patch: outlet_RSA - Phi_old = 0
Boundary patch: walls - Phi = 0
Boundary patch: walls - Phi_old = 0
outlet n. =0 pressureNew = 801.9760046 pressure_tm1 = 0
impedence Z =91300000resistence R 30300000compliance C 1.74e-08
volFlowRate =8.783959471e-06 volFlowRate_tm1 = 0
outlet n. =2 pressureNew = 3009.163059 pressure_tm1 = 0
impedence Z =524000000resistence R 174000000compliance C 3.04e-09
volFlowRate =5.742673988e-06 volFlowRate_tm1 = 0
outlet n. =1 pressureNew = 2370.838124 pressure_tm1 = 0
impedence Z =658000000resistence R 218000000compliance C 2.42e-09
volFlowRate =3.60309519e-06 volFlowRate_tm1 = 0
outlet n. =3 pressureNew = 1817.348314 pressure_tm1 = 0
impedence Z =514000000resistence R 171000000compliance C 3.09e-09
volFlowRate =3.535694883e-06 volFlowRate_tm1 = 0
outlet n. =4 pressureNew = 2473.698179 pressure_tm1 = 0
impedence Z =398000000resistence R 132000000compliance C 4e-09
volFlowRate =6.215318152e-06 volFlowRate_tm1 = 0
GAMG: Solving for p, Initial residual = 0.1266545562, Final residual = 6.283600403e-07, No Iterations 21
outlet n. =0 pressureNew = 801.9760046 pressure_tm1 = 0
impedence Z =91300000resistence R 30300000compliance C 1.74e-08
volFlowRate =8.783959471e-06 volFlowRate_tm1 = 0
outlet n. =2 pressureNew = 3009.163059 pressure_tm1 = 0
impedence Z =524000000resistence R 174000000compliance C 3.04e-09
volFlowRate =5.742673988e-06 volFlowRate_tm1 = 0
outlet n. =1 pressureNew = 2370.838124 pressure_tm1 = 0
impedence Z =658000000resistence R 218000000compliance C 2.42e-09
volFlowRate =3.60309519e-06 volFlowRate_tm1 = 0
outlet n. =3 pressureNew = 1817.348314 pressure_tm1 = 0
impedence Z =514000000resistence R 171000000compliance C 3.09e-09
volFlowRate =3.535694883e-06 volFlowRate_tm1 = 0
outlet n. =4 pressureNew = 2473.698179 pressure_tm1 = 0
impedence Z =398000000resistence R 132000000compliance C 4e-09
volFlowRate =6.215318152e-06 volFlowRate_tm1 = 0
time step continuity errors : sum local = 1.04852787e-10, global = 1.125593907e-11, cumulative = 1.124731279e-11
smoothSolver: Solving for nuTilda, Initial residual = 0, Final residual = 0, No Iterations 0
Boundary patch: inlet - Phi = -2.788074286e-05
Boundary patch: inlet - Phi_old = -2.788e-05
Boundary patch: outlet - Phi = 9.900847563e-06
Boundary patch: outlet - Phi_old = 0
Boundary patch: outlet_LSA - Phi = 5.02871383e-06
Boundary patch: outlet_LSA - Phi_old = 0
Boundary patch: outlet_LCCA - Phi = 3.426890827e-06
Boundary patch: outlet_LCCA - Phi_old = 0
Boundary patch: outlet_RCCA - Phi = 3.787690118e-06
Boundary patch: outlet_RCCA - Phi_old = 0
Boundary patch: outlet_RSA - Phi = 5.73812973e-06
Boundary patch: outlet_RSA - Phi_old = 0
Boundary patch: walls - Phi = 0
Boundary patch: walls - Phi_old = 0
ExecutionTime = 15.11 s ClockTime = 15 s



I have 8.78e-06 [m^3/s] for outlet 0 for the second pimple iteration, which is equivalent to Boundary patch: outlet - Phi = 8.78e-06 [m^3/s](outlet 0 is equivalent to boundary patch: outlet). This value changes to Boundary patch: outlet - Phi = 9.90e-06 [m^3/s] at the end of the pimple cycle. Why did I get this? Before and after the pressure equation, I placed the 'Info' to see if the values were the same. No lines of code need to run after the second 'Info' in my pimpleFoamInfo.


These are my .C boundary code(WK1FvPatchScalarField.C) and my pimpleFoamInfo:
-WK1FvPatchScalarField.C
-pimpleFoamInfo.C

I use openfoam2012.

Apologies for the length of the message, this is my first time posting in the forum, unfortunately I initially made a mistake in posting the Thread and therefore had to do a quick repost. I also apologise in advance for any misunderstandings in the code, this is the first experience as programming in openfoam.
Thanks in advance to anyone who replies.
Filippo70 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
UDF for Automatic Solution Initialization for previous case data file gartz89 Fluent UDF and Scheme Programming 6 March 30, 2020 08:38
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Velocity vector in impeller passage ngoc_tran_bao CFX 24 May 3, 2016 22:16
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


All times are GMT -4. The time now is 03:47.