New viscosity model with an "if/else" condition on the strain rate.
4 Attachment(s)
Morning foamers,
I hope you are all doing well... I'm trying to adapt the Herschel-Bulkley viscosity model available in OpenFoam. Basically the original model (attachment 1) states: " apparentViscosity = min (nu0_, (k_^n + tau0_)/strainRate) " What I want to do is the following : " if (strainRate < tau0_/nu0_) apparentViscosity = nu0_ else apparentViscosity = (k_^n + tau0_)/strainRate " Attachment 2 shows how I'am currently trying to implement it. When trying to execute the "wmake libso" command, I got the message described in Attachments 3 and 4. Obvioulsly there is something that I haven't understood yet, but I don't know what. Any comment/suggestion about what may be uncorrect? Thanks in advance and have a nice weekend. Regards. |
First of all please post your code as text not screenshots to save us some efforts in copying/editing it in our replies.
The error localizes in this line Code:
if (sr() < tau0_/nu0_) Code:
if (sr() < List<dimensionedScalar>(sr().size(), tau0_/nu0_)) Code:
forAll(sr(), i) |
2 Attachment(s)
Sir thank you very much for your reply
I made the modifications as you suggested. The first attachment is my file ''newModel.C" . The second one is the new message I get while trying to compile. Should I change another line of code? Thanks again for time. Regards. |
Code:
if (sr() < List<dimensionedScalar>(sr().size(), tau0_/nu0_)) |
2 Attachment(s)
Quote:
Hi, I want to change the HerschelBulkley viscosity model . I want to add a if-condition as follows: if strain rate is greater than gama (gama is a variable which read from the input) then calculate viscosity according to .... so I write the following code : //************************************* if (sr() < List<dimensionedScalar>(sr().size(), gama_)) { return... Attachment 75163 Attachment 75164Attachment 75163 Attachment 75164 When I write "wmake libso" it shows me the following error : error: no match for ‘operator<’ (operand types are ‘const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::List<Foam::dimensioned<double> >’) if (sr() < List<dimensionedScalar>(sr().size(), gama_)) Could you please help me? |
2 Attachment(s)
Hi,
I want to change the HerschelBulkley viscosity model . I want to add a if-condition as follows: if strain rate is greater than gama (gama is a variable which read from the input) then calculate viscosity according to .... so I write the following code : //************************************* if (sr() < List<dimensionedScalar>(sr().size(), gama_)) { return... When I write "wmake libso" it shows me the following error : error: no match for ‘operator<’ (operand types are ‘const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::List<Foam::dimensioned<double> >’) if (sr() < List<dimensionedScalar>(sr().size(), gama_)) Could you please help me? Attachment 75165 Attachment 75166 |
Code:
if (sr() < List<scalar>(sr().size(), gama_)) |
Thanks for your comment
I used your words and add following lines. tmp<volScalarField> tmpEtat = min( nu0_, (tau0_ + k_*rtone*pow(tone*sr(), n_)) /(max(sr(), dimensionedScalar ("vSmall", dimless/dimTime, VSMALL))) ); forAll (sr(), cellI) //loop through cell centres if (sr() < List<scalar>(sr().size(), gama_.value())) { tmpEtat.ref()[cellI] = min ( nu0_.value(), (tau0_.value() + k_.value()*rtone.value()*pow(tone.value()*sr.ref()[cellI], n_.value())) /(max(sr()[cellI], 0.0002)) ); } else { tmpEtat.ref()[cellI] = min ( nu0_.value(), (tau0ll_.value() + kll_.value()*rtone.value()*pow(tone.value()*sr.ref ()[cellI], n_.value())) /(max(sr()[cellI], 0.0002)) ); } return tmpEtat; The library compiled but the results are strange at the outlet boundary. |
Go for this:
Code:
forAll(sr(), cellI) |
Quote:
Thanks for your replying ,But I should use tau0_ll too. I think the code does not aply zero geadient condition for tmpEta at outlet |
All times are GMT -4. The time now is 10:05. |