Bugs in Carreau model.

In File carreauDynamicsTemplates.h from complexDynamics directory,

the recursive template to compute the effective viscoisty


template<typename T,int N>
struct ImplicitOmega
{
	T operator()(T alpha, T nu0_nuInfOverCs2, T nuInfOverCs2, T nMinusOneOverTwo, T omega0)
    {
        ImplicitOmega<T,N-1> omega;
		T omSqr = omega(alpha,nu0_nuInfOverCs2,nuInfOverCs2,nMinusOneOverTwo,omega0);
        omSqr *= omSqr;
        
		return (T)2/((T)1+(T)2*nu0_nuInfOverCs2*
                   pow((T)1+alpha*omSqr,nMinusOneOverTwo)+2 * nuInfOverCs2);
    }
};

template<typename T>
struct ImplicitOmega<T,0>
{
	T operator()(T alpha, T nu0_nuInfOverCs2, T nuInfOverCs2, T nMinusOneOverTwo, T omega0)
    {
        T omegaTmp = (T)2/((T)1+(T)2*nu0_nuInfOverCs2*pow((T)1+
				alpha*omega0*omega0,nMinusOneOverTwo)+2 * nuInfOverCs2);
    }
};

/// This structure forwards the calls to the appropriate helper class
template<typename T, int N>
struct carreauDynamicsTemplates {
	static T fromPiAndRhoToOmega(T alpha, T nu0_nuInfOverCs2, T nuInfOverCs2, T nMinusOneOverTwo, T omega0) 
{
    ImplicitOmega<T,N> omega;
    
	return omega(alpha,nu0_nuInfOverCs2,nuInfOverCs2,nMinusOneOverTwo,omega0);
}

};  // struct carreauDynamicsTemplatese]


omega is base on the Eq. 5.9 from Dr. Orestis Malaspinas’ Thesis (there are a few typos in Eq5.5 5.8 5.9, hopefully I am not wrong.). There should be a factor 2 before nuInfOverCs2. Certainly, If you don’t set nuInf in Carreau model (the default value is 0.) Then it won’t be an issue.

Plus, Even I set the exponent n = 1 in the code carreauPoiseuille.cpp, it doesn’t reproduce the poiseuille parabolic profile. (This example doesn’t come with velocity profile for the corresponding non-Newtonian fluid for setting-up the inlet boundary condition. I therefore use GuoExternalForceBGKdynamics rather than the default BGKdynamics.). Therefore, other issues might exist in the carreauDynamics.h and carreauDynamics.hh as well.

Hello,

I have to check the calculation and come back to you about this bug. It is possible that the code is wrong since I actually ran the tests only with nuInf=0.

For your other problem. It is impossible for me to tell if the result of your code is an error on my end, or an error on yours. From my code (which is not included in the palabos release for sake of brivety, since i had to solve numerically the Carreau-Poiseulle flow) the results produced are the ones that you can find in my thesis. Therefore I think the code reproduces a correct non-Newtonian behavior (up to this 2 factor that you ponted out). Plus I’m certain that the poiseuille flow with n=1 and in/outlet velocity imposed is correct in the palabos release.

Maybe if you add some details about how you added the body force, it might help. For instance did you make the boundaries periodic (you do not only have to put lattice.periodicity().toggleAll(true), you also have to remove the velocity BCs that are present. For the sake of completeness I will add my code after some cleaning in the “official” examples of palabos for the next release.

Best
Orestis

Dear Dr. Malaspinas,

The boudary condition should be fine since I have tested the case for Newtonian fluid.

As far as the non-Newtonian fluid is concerned, the problem for n = 1 was sorted out by putting the statement

	
applyIndexed(lattice, Box2D(0, nx-1, 0, ny-1), new ExternalForceInitializer<T,DESCRIPTOR>(force) );

which is used to initialize the external force field after the statement


    setCompositeDynamics (
            lattice,
            lattice.getBoundingBox(),
            new CarreauDynamics<T,DESCRIPTOR,1>(new NoDynamics<T,DESCRIPTOR>) );


I thought setCompositeDynamics would not touch the memory part of external force. No clue what happened to the external force if I put ComositeDynamics after applyIndexed then what caused the problem even with n = 1.

Plus, I mimiced the file carreauDynamicsTemplates to model non-Newtonian fluid in terms of power law that has analytical solutions for different n value based on the same local iteration and last time step omega. I then came across the problem that the result is not quite right, too. So I asked another question about how to computePhiNeq in http://www.palabos.org/forum/read.php?4,5891. Apologies for my confusion on moments and momentum as I thought rho = 1.

Cheers,

Hello,

so I checheck and you were right about the factor 2. It will be corrected in the next release of palabos. Thank you for the bug report. I also checked my code, and the code works perfectly since nuInf=0 there. The carreau-poiseuille will also be in the next release of the code.

For your other question I can’t answer you since I’m missing all the details of your code. But in my experience, the power law is working, although you may experience problems (especially at low shear rate where the viscosity is diverging).

Best regards
Orestis

Dear Dr. Malaspinas,

Thank you for your time and look forward to seeing the next release.

You are absolutely right. The diverenge (the problem) was due to very small shear rate that causes omega is around 2 (your code on Carreau model probably will experience the same issue as it invovles pow(smallnumber, (n-1)/2).

So, inceasing shear rate solves the problem.

Cheers,

malaspin Wrote:

Hello,

so I checheck and you were right about the factor
2. It will be corrected in the next release of
palabos. Thank you for the bug report. I also
checked my code, and the code works perfectly
since nuInf=0 there. The carreau-poiseuille will
also be in the next release of the code.

For your other question I can’t answer you since
I’m missing all the details of your code. But in
my experience, the power law is working, although
you may experience problems (especially at low
shear rate where the viscosity is diverging).

Best regards
Orestis