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

Using a new implemented viscosity model with simpleFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 3, 2017, 04:39
Default Using a new implemented viscosity model with simpleFoam
  #1
Member
 
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9
TemC is on a distinguished road
Good morning foamers,

I'am working with simpleFoam, and I just implemented a new viscosity model, based on the so called "regularization of Papanastasiou". In order to do that, I have adapted the Herschel-Bulkley model already available in OpenFoam.

After that, I succesfully managed to compile the necessary library, so that my new viscosity model is now valid and available.

Now when I try to run a case with my new viscosity model, I always got an error message ("attachment 1") that I don't understand...

That's the reason why I come here to ask if anybody has already encountered this type of error while running a case.

May it be linked to the way I formulated the viscosity model? ...

- "attachment 2" is the original formulation of the Herschel-Bulkley modeil in OpenFoam;

- "attachment 3" is the formula I needed to implement ;

- "attachment 4" shows how I put it in my "newViscosityModel.C" file.

Of course any comment/suggestion will be well appreciated.

Thanks in advance for your time, and have a nice weekend.

Regards.
Attached Images
File Type: jpg Simulation_Error.jpg (78.7 KB, 46 views)
File Type: png initial_Herschel-Bulkley_model.PNG (26.9 KB, 45 views)
File Type: png HB_Papanastasiou.PNG (9.1 KB, 41 views)
File Type: png newViscosityModel.PNG (51.4 KB, 38 views)
TemC is offline   Reply With Quote

Old   March 3, 2017, 05:43
Default
  #2
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Hi,

for the error you get, there is a divided by zero over there. Are you sure that for the first iterations, you get a non zero diffusivity?
agustinvo is offline   Reply With Quote

Old   March 3, 2017, 08:39
Default
  #3
Member
 
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9
TemC is on a distinguished road
Morning Sir,

First of all thank you for your quick reply.
The initial formulation of the Herschel-Bulkley model is the following :

// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * *

Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::HerschelBulkleySimple::calc Nu() const
{
dimensionedScalar tone("tone", dimTime, 1.0);
dimensionedScalar rtone("rtone", dimless/dimTime, 1.0);
tmp<volScalarField> sr(strainRate());

return
(
min
(
nu0_ ,
( tau0_ + k_* rtone * ( pow(tone * sr(), n_)) ) / (max(sr(), dimensionedScalar ("VSMALL", dimless/dimTime, VSMALL)))
)
);
}

In this formulation, the denominator "max(...)" is supposed to avoid the division by zero, if the strain rate "sr()" is too small or equal to zero.
That's why I picked up this tip in order to build the formulation I need.

Now the difference is that, in the formulation I have to implement, there is no parameter "nu0_" (since the formula is supposed to work whatever the value of the strain rate). This implies that in my "return" block, I don't have a sub-block "min(nu0_, apparentViscosity).

Regarding your remark, I'am now wondering if I shouldn't write the expression of my apparentViscosity (attachment 4) differently...

Regards.
TemC is offline   Reply With Quote

Old   March 6, 2017, 01:43
Default
  #4
Member
 
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9
TemC is on a distinguished road
Hi foamers,

Hope you had a good weekend. I'am still stucked with the difficulty to use a different version of the original Herschel-Bulkley model in OpenFoam.

By trying different equations for the apparent viscosity, I found out that whatever the expression I use, I got the same error message when I launch a simulation. Here are some examples of some expressions that I use ( in the file "newHerschelBulkley.C" ) :

a).

return
(
k_*rtone*(pow(tone*sr(),n_))
/ max(sr(), dimensionedScalar ("VSMALL", dimless/dimTime, VSMALL))
);
}

b).

return
(
(
(k_*rtone* ( pow(tone*sr(),n_)))/ (max(sr(), dimensionedScalar ("VSMALL", dimless/dimTime, VSMALL)))
+ (1.0 - exp(-m_*sr()*tone))*((tau0_) / (max(sr(), dimensionedScalar("VSMALL", dimless/dimTime, VSMALL))))
)
);
}

c).

return
(
min
(
(m_*tone*tau0_),
((1.0-exp(-1.0*m_*tone*sr()))*tau0_ + k_*rtone*pow(tone*sr(), n_))
/(max(sr(), dimensionedScalar ("VSMALL", dimless/dimTime, VSMALL)))
)
);
}

Only the initial formulation of the model seems to work, which is :

return
(
min
(
nu0_,
(tau0_ + k_*rtone*pow(tone*sr(), n_))
/(max(sr(), dimensionedScalar ("VSMALL", dimless/dimTime, VSMALL)))
)
);
}

And even a slightly modification of this formulation leads to the same error message. Does anybody have a comment/suggestion about that?

PS: I compile all my modified models within my "run" directory, I don't touch anything in the source code ( "src/transportModels/..." )

Thanks in advance, and have a nice week.

Regards.
TemC is offline   Reply With Quote

Old   March 6, 2017, 03:21
Default
  #5
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Hello,and what do you have in your transportProperties? If the equations are ok, the input is the problem.
agustinvo is offline   Reply With Quote

Old   March 6, 2017, 04:15
Default
  #6
Member
 
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9
TemC is on a distinguished road
Morning Sir,

Thanks for your reply.
I send in attachments my "constant/transportProperties" file. As you can see, I always take the same parameters for all the viscosity models. With the original Hershel-Bulkley model, the simulation runs very well with those parameters. But once I pick another model, the simulation fails.

PS: Each time I attempt to use a new viscosity model, I make sure to include the right library into the file system/controdict.

Another thing that I noticed is is that when I use the regularization parameter "m_", even when I change its value (300, 600, 1000 for example), I still got the same error...

Regards.
Attached Files
File Type: txt transportProperties.txt (2.4 KB, 16 views)
TemC is offline   Reply With Quote

Old   March 8, 2017, 03:07
Default
  #7
Member
 
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9
TemC is on a distinguished road
Hi foamers,

Just to say that I found out what I was doing wrong:

Each time I copied the original Herschel-Bulkley model into my run directory, after making the required modifications, I used to execute the command "wclean" before creating the library with "wmake libso".

I realized that without using the "wclean" command, by creating the library right after modifying the files, I don't get the error while launching the simulation with the new viscosity model.

Thanks again for your comments/suggestions.

Regards.
TemC 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
simpleFoam with Launder-Sharma Model examosty OpenFOAM 8 July 12, 2023 14:10
Use of k-epsilon and k-omega Models Jade M Main CFD Forum 40 January 27, 2023 07:18
Viscosity model in the twoPhaseEulerFoam enoch OpenFOAM Programming & Development 3 March 17, 2016 09:53
creepin flow with a new viscosity model bagherij OpenFOAM Programming & Development 6 July 4, 2015 20:08
Viscosity ratio in gamma-theta transition model based on k-w sst turb model Qiaol618 Main CFD Forum 8 June 9, 2012 06:43


All times are GMT -4. The time now is 21:06.