|
[Sponsors] |
Using a new implemented viscosity model with simpleFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 3, 2017, 05:39 |
Using a new implemented viscosity model with simpleFoam
|
#1 |
Member
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9 |
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. |
|
March 3, 2017, 06:43 |
|
#2 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15 |
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? |
|
March 3, 2017, 09:39 |
|
#3 |
Member
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9 |
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. |
|
March 6, 2017, 02:43 |
|
#4 |
Member
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9 |
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. |
|
March 6, 2017, 04:21 |
|
#5 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15 |
Hello,and what do you have in your transportProperties? If the equations are ok, the input is the problem.
|
|
March 6, 2017, 05:15 |
|
#6 |
Member
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9 |
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. |
|
March 8, 2017, 04:07 |
|
#7 |
Member
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9 |
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
simpleFoam with Launder-Sharma Model | examosty | OpenFOAM | 8 | July 12, 2023 15:10 |
Use of k-epsilon and k-omega Models | Jade M | Main CFD Forum | 40 | January 27, 2023 08:18 |
Viscosity model in the twoPhaseEulerFoam | enoch | OpenFOAM Programming & Development | 3 | March 17, 2016 10:53 |
creepin flow with a new viscosity model | bagherij | OpenFOAM Programming & Development | 6 | July 4, 2015 21:08 |
Viscosity ratio in gamma-theta transition model based on k-w sst turb model | Qiaol618 | Main CFD Forum | 8 | June 9, 2012 07:43 |