# Piecewise viscosity model

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 June 10, 2010, 05:14 Piecewise viscosity model #1 Member   Jitao Liu Join Date: Mar 2009 Location: Jinan , China Posts: 64 Rep Power: 10 Dear foamers, I'd like to create a piecewise viscosity model described as following: (1) when T=Tg, viscosity varies with temperature, pressure and strain rate: nu= (B_*exp(B1_*pd)*exp(Tb_/T))/(RHO_*(scalar(1)+pow((B_*exp(B1_*pd)*exp(Tb_/T))*strainRate()/t1_, scalar(1)-n_))); where B, B1, Tb, t1, n are material constants. How to define this piecewise function in calcNu() in user-defined viscosity model? Best regards, Jitao

 June 10, 2010, 06:12 #2 Member   Jitao Liu Join Date: Mar 2009 Location: Jinan , China Posts: 64 Rep Power: 10 The modefied NewCrossArrhenius.C: #include "NewCrossArrhenius.H" //#include "twoPhaseMixture.H" #include "addToRunTimeSelectionTable.H" #include "surfaceFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { namespace viscosityModels { defineTypeNameAndDebug(NewCrossArrhenius, 0); addToRunTimeSelectionTable ( viscosityModel, NewCrossArrhenius, dictionary ); } } // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // Foam::tmp Foam::viscosityModels::NewCrossArrhenius::calcNu() const { const volScalarField& T=U_.mesh().lookupObject("T"); const volScalarField& pd=U_.mesh().lookupObject("pd"); forAll(T, cell) { if ( T [cell]> B_; NewCrossArrheniusCoeffs_.lookup("B1") >> B1_; NewCrossArrheniusCoeffs_.lookup("Tb") >> Tb_; NewCrossArrheniusCoeffs_.lookup("t1") >> t1_; NewCrossArrheniusCoeffs_.lookup("n") >> n_; NewCrossArrheniusCoeffs_.lookup("RHO") >> RHO_; NewCrossArrheniusCoeffs_.lookup("INF") >> INF_; NewCrossArrheniusCoeffs_.lookup("Tg") >> Tg_; return true; } // ************************************************** *********************** // The compilation of this visocosity model ended up with following errors : viscosityModels/NewCrossArrhenius/NewCrossArrhenius.C:81: error: no match for ‘operator<’ in ‘((const Foam::volScalarField*)T)->Foam::GeometricField::.Foam:imensionedField ::.Foam::Field::< anonymous>.Foam::List::.Foam::U List:perator[] [with T = double](cell) < ((const Foam::viscosityModels::NewCrossArrhenius*)this)->Foam::viscosityModels::NewCrossArrhenius::Tg_’ viscosityModels/NewCrossArrhenius/NewCrossArrhenius.C:83: error: conversion from ‘const Foam::dimensionedScalar’ to non-scalar type ‘Foam::tmp >’ requested

 June 11, 2010, 13:55 #3 New Member   Dan Gadensgaard Join Date: Apr 2010 Posts: 13 Rep Power: 9 Hi.. I have just recently had similar problems in implementing a frozen layer. I did not succeed as it showed som strange results, however i did get a working compilation. When comparing a cell value (T[cell]) with a constant (Tg_) i found that it was neccessary to do it with the suffix .value() on the constant, as shown below: ... if ( T [cell]

June 21, 2010, 23:10
#4
Member

Jitao Liu
Join Date: Mar 2009
Location: Jinan , China
Posts: 64
Rep Power: 10
Quote:
 Originally Posted by dgadensg Hi.. I have just recently had similar problems in implementing a frozen layer. I did not succeed as it showed som strange results, however i did get a working compilation. When comparing a cell value (T[cell]) with a constant (Tg_) i found that it was neccessary to do it with the suffix .value() on the constant, as shown below: ... if ( T [cell]
Hi Dan,

Thank you very much. I have compiled this Piecewise viscosity model. When running a case using this model, the calculation always stopped due divergence. And the claculated temperature field is strange.

Have you successed in implementing the frozen layer? Please give me some suggections. Thanks in advance.

Kind regards,
Jitao

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post prjohnston OpenFOAM Running, Solving & CFD 6 July 3, 2015 04:26 Godwin FLUENT 1 December 12, 2011 06:42 mpml OpenFOAM Running, Solving & CFD 4 October 13, 2010 07:44 James CFX 10 September 12, 2006 03:16 Hp FLUENT 4 June 1, 2004 20:42

All times are GMT -4. The time now is 16:30.

 Contact Us - CFD Online - Privacy Statement - Top