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

If else condition in PowerLaw viscosity model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2019, 05:18
Default If else condition in PowerLaw viscosity model
  #1
New Member
 
Join Date: Jun 2019
Posts: 17
Rep Power: 6
zcheng is on a distinguished road
Hello everyone I am new to OpenFoam and I would like to know if it's possible to implement an if else condition in Power Law viscosity model?

if (a<0.8)
{
nuMin nuMax loop of PowerLaw;
}
else
{
nu = 10*a;
}

Thanks a lot.
zcheng is offline   Reply With Quote

Old   February 27, 2020, 13:13
Default
  #2
New Member
 
tooran
Join Date: Nov 2016
Posts: 23
Rep Power: 9
tooran is on a distinguished road
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?
Attached Files
File Type: c MyHerschelBulkley.C (4.2 KB, 1 views)
File Type: h MyHerschelBulkley.H (3.6 KB, 1 views)
tooran is offline   Reply With Quote

Old   February 28, 2020, 03:37
Default
  #3
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
Operator < needs to be overloaded for classes of objects you are using on both side of the operator.
ybapat 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
Viscosity model - error: object is not allocated - C++ beginner avila.vc OpenFOAM Programming & Development 5 February 14, 2022 02:00
New Viscosity model in DriftFluxFoam yang.l OpenFOAM 2 December 2, 2017 06:56
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 17:38
Adding a new viscosity model ICL OpenFOAM Running, Solving & CFD 20 April 10, 2017 22:44
Questions about Cross-Arrhenius and Cross-WLF viscosity model awacs OpenFOAM Running, Solving & CFD 4 August 13, 2009 06:56


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