CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Barotropic Compressibility & Periodicity (

gregdB August 8, 2012 10:07

Barotropic Compressibility & Periodicity
Hi foamers,

I have a problem relating to periodic boundary conditions for barotropic compressible flow and I was looking for some direction.

The density I am modelling is purely a function of pressure (the compressibility is not constant but rather a function of pressure itself) and I am solving for laminar Navier-Stokes and the continuity equations.

I have written a solver based on rhoSimpleFoam which calculates the density from pressure and then solves for the pressure and velocity fields in the usual way. This is fine and works well for standard boundary conditions applied to p and U.

But my problem relates to periodicity for which I must use the fan BC in order to generate a pressure gradient across my geometry. This result of which is that I now require a scaled version of the cyclic BC which includes the effects of pressure on density.

rho_m * U_m = rho_n * U_n
(Where m and n represent the master and neighbour sides of the cyclic boundary)
It can be shown that this scaling is the same for each component of velocity.

The values of rho_m and rho_n and be replaced by the function which describes their relationship to pressure and as such the velocity BC for the master patch becomes dependent on the pressure and velocity fields of the neighbour side.

I have implemented this by copying and adjusting the mechanics of the following fvPatchFields: fan, fixedJump and jumpCyclic. These BC's have the same outcomes as I require but defined only for scalar fields and profile jumps (not scaling).

I now have periodic boundary conditions which implement the mathematics as described but when I run with my solver on a uniform rectangular grid continuity is never satisfied over the domain and as a result the pressure and velocity fields are non-physical. These non-physical effects are seen across the cyclic interface.

Interestingly mass continuity across the cyclic boundary is solved. The same profile of mass flow into the domain leaves the domain, and the pressure jump can also be seen. Meaning that the BC's are met. And so the question is why does the solution not converge?

After spending sometime looking into the boundary condition hierarchy of openfoam I have realised that this problem may relate to how the gradients of each field are copied across the boundary.

For example, with the fan BC it is acceptable to only copy and change the values of the field across the interface because the gradient of a function which has been shifted by a constant is consistent to the original. This does not hold for scaling, i.e. the gradient must also be scaled by the same amount as the value itself.

So if I was able to scale the gradients in the same way as the field values will my problem converge given my solver and BC's? Given that these functions lie in coupledFvPatchField and will be different to cyclicFvPatchField, will I have to create a whole new type of BC rather than a derived class of cyclic?

Or am I missing something obvious?

Many thanks,

All times are GMT -4. The time now is 02:53.