
[Sponsors] 
April 8, 2013, 06:40 
how to convert to dimensionless scalar in openfoam

#1 
New Member
mehdi
Join Date: Nov 2010
Location: Tehran
Posts: 16
Rep Power: 8 
Dear OpenFoamers
I'm already trying to write a code for simulating conformational rheological problems. my code is complied well but when I try to use it this error appears: > FOAM FATAL ERROR: Argument of trancendental function not dimensionless From function trans(const dimensionSet&) in file dimensionSet/dimensionSet.C at line 480. I found the source of error may exist in these lines of my code: //size of shear rate tensor (which is dimensioned scalar) volScalarField sizegamadot = Foam::sqrt ( 0.5 * (twoD && twoD) ); //ci is a nondimensioned variable which is calculated by this //formula : ci = ((0.0076*ln(sizegamadot) + 0.0385)/0.1876)^1.998 volScalarField ci = Foam:ow( ((0.0076 * Foam::log (sizegamadot)) + 0.0385) / 0.1876 ) ,1.998 ); // solving equation for a. tmp<fvSymmTensorMatrix> aEqn ( fvm::ddt(a_) == keisi * ( (twoD & a_) + (a_ & twoD) ) + 4 * ci * sizegamadot * (I_  3*a_) ); aEqn().relax(); solve(aEqn); where keisi is a dimensionless scalar ,a_ is dimensionless tensor , twoD is shear rate tensor ( dimesnion = grad velocity = 1/s ) and I_ is identity tensor(dimensionless) although ci is dimensionless in real world but this formula makes openFoam to consider it as a dimensioned scalar.(I don't know really why it happens?!! ) however, my question is how i should convert ci in to a dimensionless scalar which can be use in the aEqn? any help would be appreciated. 

April 20, 2013, 23:35 

#2  
New Member
Chris Prohoda
Join Date: Mar 2013
Posts: 6
Rep Power: 5 
Quote:


April 21, 2013, 03:31 

#3 
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 297
Rep Power: 15 
Cpro is right, sizegamadot is not dimless and this is causing the problem.
The easiest way of solving this, is by writing something as Code:
volScalarField sizegamadot = Foam::sqrt ( 0.5 * (twoD && twoD) ); dimensionedScalar one = ("one",1/sizegamadot.dimensions(),1.0); volScalarField ci = Foam::pow( ((0.0076 * Foam::log (one*sizegamadot)) + 0.0385) / 0.1876 ) ,1.998 ); Cheers, L 

February 25, 2014, 07:56 

#5 
Member
Rohith
Join Date: Oct 2012
Location: Germany
Posts: 57
Rep Power: 6 
I am trying to implement an additional source term in energy equation, please suggest me the bug in my code.
Required Source term: 0.5*(1tanh^2((TmT)/epsilon))/epsilon I have placed a code Code:
{ dimensionedScalar epsilon ( "epsilon", dimensionSet(0, 0, 0, 0, 0, 0 ,0), 0.05 ); dimensionedScalar half ( "half", dimensionSet(0, 0, 0, 0, 0, 0 ,0), 0.5 ); dimensionedScalar one ( "one", dimensionSet(0, 0, 0, 0, 0, 0 ,0), 1 ); dimensionedScalar forty ( "forty", dimensionSet(0, 0, 0, 0, 0, 0 ,0), 40 ); = half*(oneFoam::pow(Foam::tanh((TmeltT)/epsilon),2)) How can i get it in a better way, i thought writing tanhx in exponential form but the same bug HTML Code:
FOAM FATAL ERROR: Argument of trancendental function not dimensionles Thanks in Advance Rohith 

February 25, 2014, 08:08 

#6  
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 297
Rep Power: 15 
Hi Rohith,
The error is related the remark I give above: Quote:
Also, I think you mean Code:
(tanh((TmT)/epsilon)))^2 Cheers, L 

February 25, 2014, 08:17 

#7 
Member
Rohith
Join Date: Oct 2012
Location: Germany
Posts: 57
Rep Power: 6 
Hi Lieven
I even don't want the (TmT)/epsilon to become dimensionless, however by using T.value(), it says that this scalar field doesn't have a member of this kind. how about converting the hyperbolic function into exponential and writing it? what do you think, i have tried it but the exp (temperature) must work, but theoretically it is not working for me Greetings Rohith 

February 25, 2014, 08:37 

#8 
Senior Member
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,461
Rep Power: 25 
Hi,
value is a method of dimensionedScalar, volScalarField has field method (http://foam.sourceforge.net/docs/cpp...873157f6ed35c3). Also instead of Code:
dimensionSet(0, 0, 0, 0, 0, 0 ,0) Code:
dimensionedScalar epsilon ( "epsilon", dimless 0.05 ); 

February 25, 2014, 08:44 

#9 
Member
Rohith
Join Date: Oct 2012
Location: Germany
Posts: 57
Rep Power: 6 
Hi
Ya it is not a big question here, i may be have used scalar(0.05) or dimless you are right, i will refine it. But the main issue concerns to the implementation of the equation described above Ideas? Greetings RR 

February 25, 2014, 09:03 

#10 
Senior Member
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,461
Rep Power: 25 
Well,
First of all OpenFOAM is right and there's no such thing as exponent of kelvins. Argument of transcendent function should be dimensionless. Concerning your equation, you can 1. Set dimension of epsilon to the temperature, as (I guess) it is the melting temperature range. So (Tm  T)/epsilon will be dimensionless. 2. Use T.field(), Tm.value() and epsilon.value() if you insist on them being dimensioned. Though it was suggested by Lieven. 

February 25, 2014, 09:47 

#11 
Member
Rohith
Join Date: Oct 2012
Location: Germany
Posts: 57
Rep Power: 6 
Hi
The second one doesnt work, but first one can be used with some more alterations. Greetings RR 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
dieselFoam problem!! trying to introduce a new heat transfer model  vivek070176  OpenFOAM Programming & Development  10  December 24, 2014 00:48 
Solving for an additional species CO in coalChemistryFoam  N. A.  OpenFOAM Programming & Development  2  November 13, 2014 09:43 
Specifying nonuniform boundary condition  maka  OpenFOAM Running, Solving & CFD  59  October 22, 2014 14:52 
To convert Mesh from OpenFoam to GMSH  gara1988  OpenFOAM Running, Solving & CFD  1  October 12, 2012 09:43 
How to convert a mesh into openfoam format  jr33  OpenFOAM Meshing & Mesh Conversion  1  October 2, 2012 17:20 