CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Pulsatile Womersley velocity profile (https://www.cfd-online.com/Forums/openfoam-solving/83612-pulsatile-womersley-velocity-profile.html)

 bephi January 5, 2011 08:53

Pulsatile Womersley velocity profile

Hello everybody,
as the topic says I would like to set up a pulsatile womersley velocity profile for my inlet BC!
of course first of all I searched and read a lot about possibilities but I just found something about
- OscillatingFixedValue
- timeVaryingUniform
- Contrib_groovyBC

The Womersley velocity profile is changing in time and space I would say, so what will be a possibility to set it for my inlet? Is it possible with groovyBC from Bernhard and if yes, how and where can I put this complicated formula for the velocity?

thank you so much!

 abhro April 3, 2011 22:53

Hi,
Were you able to set womersley velocity profile as inlet for your problem?

 bephi April 4, 2011 11:25

Hi!
Yes I used the groovyBC from Bernhard! Works quite well!
Greets!
Philipp

 abhro April 4, 2011 11:33

Hi
Could you tell me how did you implement it using groovyBC? Even i need to get a womersley profile for my inlet condition..
Thanks !

 bephi April 4, 2011 12:41

You have to compile the bc as described and add the libs-line in the controlDict. Afterwards you are able to use the womerley-equation. But be aware of the fact that sinh and cosh are not known in groovyBC. but you can easiy convert them with the exp()-function!

 abhro April 5, 2011 18:07

Thanks for your help philip! i`ll try out what you suggested.

 abhro April 5, 2011 18:57

Hi Philip,
Can you tell me the extact expression you entered in the variables part of the groovyBC inlet condition? I am not very sure about what to do with the Bessel function that comes into the inlet profile ..
Thanks a lot for your time.

 bephi April 6, 2011 02:22

Good morning!
I have no access to the files right now but I used the real part of the complex function which is:
http://www-e.uni-magdeburg.de/~berg/...cityprofil.jpg

As I said just take care of the sinh and cosh!
I hope that helps!
Greets!

 gschaider April 6, 2011 04:41

Quote:
 Originally Posted by bephi (Post 302171) You have to compile the bc as described and add the libs-line in the controlDict. Afterwards you are able to use the womerley-equation. But be aware of the fact that sinh and cosh are not known in groovyBC. but you can easiy convert them with the exp()-function!
I just checked in the current version of swak4Foam and sinh etc are there. Not sure since when and not sure whether it is also there in the last version of "pure" groovyBC (probably the Wiki-page never got updated)

 nihil July 20, 2011 11:09

Womersley profile - oscillatory pipe flow - complex bessel

Hi there,

I also want to use the Womersley profile as a Dirichlet velocity BC and decided to implement my own BC starting from parabolicVelocity and oscillating fixedValue...

Since I need the Womersley profile for a pipe (3d) and not for a channel (2d), I have to deal with the complex Bessel function J0(z) instead of cosh.

Therefore, I started to implement the functions j0(z), exp(z), pow(z,n), sqrt(z,n) etc for complex numbers (z), which are, as far as I know, not implemented in OF yet, right?

My C++ is very poor, so I have some questions and could use some help here.

1.) Is src/OpenFOAM/primitives/complex/complexI.H the right place to implement these functions like this?
.
.
.
#include <complex>
.
.
.
// *************** Friend Functions ************** //
inline complex exp(const complex& c)
{
std::complex<double> z(c.re, c.im);
z = std::exp(z);
return complex(z.real(), z.imag());
}

.
.
.

3.) Or is there a better way / place to do that?

4.) Where should I implement such a function like factorial(Foam::scalar), which is also needed to evaluate complex J0? In src/OpeanFOAM/primiteves/Scalar/Scalar.H or is there a better place to do that?

5.) How do implement the Bessel function not only for a single scalar but for a scalarField, because I need this for the BC. I couldn't find an example how this is done for other functions, to start with.

6.) How do I implement the BC that it will work in parallel with maybe one or more processor boundaries on the patch? Is there somthing special to consider?

Thanks for any comments and suggestions

Cheers
Daniel

 bephi July 20, 2011 12:38

hi daniel,
its great that you want to implement the complete womersley profile in 3D! i would like to improve my BC as well but i am in cambodia on vacation until the 1st of august and the internet is pretty slow!
but in the first week of august i am back at work.

it would be nice if we can make some progress with the BC in openfoam!
best regards!
philipp

 gschaider July 20, 2011 17:58

Quote:
 Originally Posted by nihil (Post 316806) Therefore, I started to implement the functions j0(z), exp(z), pow(z,n), sqrt(z,n) etc for complex numbers (z), which are, as far as I know, not implemented in OF yet, right?
Bessel functions are (see the Programmers guide), but not for complex numbers.

If you manage to get your formula to pure real functions (you'll need one in the end anyway) you might as well use groovyBC again (Bessel functions are there under the names besselJ0 etc)

 nihil July 21, 2011 10:35

Quote:
 Originally Posted by gschaider (Post 316839) Bessel functions are (see the Programmers guide), but not for complex numbers.
Yes I know that, and I allready used it. As far as I understood, the standard <cmath> Bessel is loaded in
src/OpenFOAM/primitives/Scalar/Scalar.H, right?

Quote:
 Originally Posted by gschaider (Post 316839) If you manage to get your formula to pure real functions (you'll need one in the end anyway) you might as well use groovyBC again (Bessel functions are there under the names besselJ0 etc)

I don't know if this is possible. I might be wrong but the formular reads somthing like

u(r,t) = exp(z*t) * (1 - J0(z*r) / J0(z) ) with z = complex number,

so one have to take u.Re() as physically relevant part in the very end...!?!

However, I allready implemented all the necessary formulas in C-Code (or lets better say I copy-pasted all the stuff from elsewhere, just put it together in the right order and slightly modified it :)). It works fine, it's veryfied and
I get nice oscillating Womersley profiles...

Furthermore, I allready implemented all the functions for complex scalars in OF, that works fine too. (see question 1, 3, 4)

But now I have problems to make all the operators and functions work also for "complexScalarFields". How do I do that? (see question 5, 6 )

Cheers
Daniel

 liguifan August 2, 2011 07:51

Quote:
 Originally Posted by bephi (Post 302421) Good morning! I have no access to the files right now but I used the real part of the complex function which is: http://www-e.uni-magdeburg.de/~berg/...cityprofil.jpg As I said just take care of the sinh and cosh! I hope that helps! Greets!
Hi Bephi,

I am very interested your post about the expression of Womersley. But I can not open the photo you post. Can you please let me know how you implement the Womersley expression? Thanks a lot.

 liguifan August 3, 2011 00:12

Quote:
 Originally Posted by nihil (Post 316942) Hej and thanks for replying! Yes I know that, and I allready used it. As far as I understood, the standard Bessel is loaded in src/OpenFOAM/primitives/Scalar/Scalar.H, right? I don't know if this is possible. I might be wrong but the formular reads somthing like u(r,t) = exp(z*t) * (1 - J0(z*r) / J0(z) ) with z = complex number, so one have to take u.Re() as physically relevant part in the very end...!?! However, I allready implemented all the necessary formulas in C-Code (or lets better say I copy-pasted all the stuff from elsewhere, just put it together in the right order and slightly modified it :)). It works fine, it's veryfied and I get nice oscillating Womersley profiles... Furthermore, I allready implemented all the functions for complex scalars in OF, that works fine too. (see question 1, 3, 4) But now I have problems to make all the operators and functions work also for "complexScalarFields". How do I do that? (see question 5, 6 ) Cheers Daniel
Hi nihil,

Did you successfully implement the Womersley pulsatile inlet flow using u(r,t) = exp(z*t) * (1 - J0(z*r) / J0(z) ) where z is complex number?

I am working on the same thing as well. Where is the A/z*rho*w term gone?

Very interested!

 bephi August 10, 2011 03:42

Quote:
 Originally Posted by liguifan (Post 318492) Hi Bephi, I am very interested your post about the expression of Womersley. But I can not open the photo you post. Can you please let me know how you implement the Womersley expression? Thanks a lot.
Hi and sorry for the late answer. Well, I implemented the following version of the real part of the Womersley solution:

For this I used groovyBC from Bernhard (thanks again!) which worked quite well.
First I tested with a standard parabolic velocity profile and then changed to the formula above.
greets!

 liguifan August 10, 2011 04:11

Quote:
 Originally Posted by bephi (Post 319576) Hi and sorry for the late answer. Well, I implemented the following version of the real part of the Womersley solution: http://s1.directupload.net/images/11...p/d9oxrf2k.jpg For this I used groovyBC from Bernhard (thanks again!) which worked quite well. First I tested with a standard parabolic velocity profile and then changed to the formula above. greets!

But how do you decide the value of A. eg, How do you find the mean velocity of the flow? or I know the mean velocity at different t, how can I find A in this formula?

Any ideas?

Thanks a lot!

 bephi August 10, 2011 05:00

Quote:
 Originally Posted by liguifan (Post 319581) Thanks for replying! But how do you decide the value of A. eg, How do you find the mean velocity of the flow? or I know the mean velocity at different t, how can I find A in this formula? Any ideas? Thanks a lot!
This depends on the amplitude and mean velocity you like to have. I don't know for what you are needing this profile. In my case it was a model of the basilar arterie in the Circle of Willis so I got the values from literature....

 liguifan August 11, 2011 03:40

1 Attachment(s)
Quote:
 Originally Posted by bephi (Post 319588) This depends on the amplitude and mean velocity you like to have. I don't know for what you are needing this profile. In my case it was a model of the basilar arterie in the Circle of Willis so I got the values from literature....
Hi bephi,

Thanks for showing the formula.

I may not explain it properly in last post. Sorry for that.

Here is a mean velocity vs time figure from a journal paper. We can see the mean velocity profile is asymmetric across 1s.

They use womersley inlet condition with womersley number 7, they give the property of the blood and geometry of the artery. So I can easily find the frequency w. Then substitute w( which is n in your formula ). I got a parabolic velocity profile pulse with time. But the velocity profile seem to be symmetrical, which like a sin function across 1s ( time period ). You may notice that in your simulation. If so, please let me know how would you make an asymmetric velocity profile and find the A in your formula?

I appreciate!

 nihil August 22, 2011 05:51

Womersley profile - oscillatory pipe flow - complex fields

Hi,

I was very busy with other stuff the last weeks, but now I try to finish my Womersley profile BC...

Can someone tell me how and where to overload the operators for complexFields? For example, my problem is:

Why does this work?

scalarField stf1 = scalarField(7);
scalarField stf2 = 5 + stf1 ;

But this does not?

complex c = complex( 3, 9 ) ;
complexField ctf1 = ReComplexField( 7 ) ;
complexField ctf2 = c + ctf1 ;

error: no match for ‘operator+’ in ‘c + ctf2’
...