CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Set different viscosities for different areas (https://www.cfd-online.com/Forums/openfoam-solving/57978-set-different-viscosities-different-areas.html)

eldudereeno January 22, 2009 07:19

Hello everybody. I would li
 
Hello everybody.

I would like to know weather it is possible in openFOAM to define different viscosities for different areas?

I would like to simulate the flow of magnetorheological fluids which change there viscosities passing a magnetic field.

I am using the HerschelBulkely model, where i have a tau0.
In the areas with magnetic field it would be great if i could increase the tau0 regarding to my field.

Any ideas?

Thanks for possible answers

Best Regards

grtabor January 22, 2009 08:31

Should be fine - make tau0 a v
 
Should be fine - make tau0 a volScalarField and increase it where necessary. Should work.

Gavin

eldudereeno January 22, 2009 09:56

Sounds good! Thanks a lot,
 
Sounds good!

Thanks a lot, Gavin!

But could you please explain it for me?
I am very new in OF.

Where shall i do it ? In the transport model (HerschelBulkley) or in the transportProperties ?

grtabor January 26, 2009 04:36

Ouch. Having had a chance to h
 
Ouch. Having had a chance to have a look at it it is a little more complicated. HerschelBulkley is a class derived from viscosityModel making it run-time selectable (which is nice, of course). To change it you would need to create your own class; probably copy the header and class files across to a new directory, rename it, and then alter it appropriately. Having done this you would need to recompile viscosityModels. The alternative would be to start from scratch and implement your own viscosity law into icoFoam (you could probably extract quite a lot of the appropriate code from HerschelBulkley). How is your C++ coding??

Either way, you need to change tau0 to a volScalarField. Instead of declaring it as a dimensionedScalar and reading it from the transportProperties dictionary you would need to create it as a volScalarField and read it in from a file in the timestep directory via an IOobject. To see how to do this, look at the declaration of the field "p" in createFields.H

Gavin

eldudereeno February 10, 2009 11:27

Thank you Gavin! I made tau
 
Thank you Gavin!

I made tau0 a colScalarField (which indeed took a long time, hehe)
Via setFields i was able to declare at in the neccesary places.

But the transport modell is of course still using the tau0 of my transportProperties.

My C++ Coding is pretty poor.
I copied the HerschelBulkely class and renamed it.
Than i was even able to compile it and make it usable for my calculation.

But i have absolutely no idea how to change:
read tau0 not as a fixed variable but as a field.

Peter


All times are GMT -4. The time now is 01:16.