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

Error for User defined Variables

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 17, 2015, 07:29
Default Error for User defined Variables
  #1
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Hi,
I have tried to create a new solver darcyFoam . But I am facing error saying that

/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/zeroI.H:72:13: note: template argumen t deduction/substitution failed:
darcyFoam.C:64:24: note: cannot convert ‘Foam:perator*(const Foam::dimensioned<double>& , const Foam::dimensioned<Type>&) [with Type = double]((*(const Foam::dimensioned<double>*) (& mu)))’ (type ‘Foam::dimensioned<double>’) to type ‘const Foam::zero&’
k = -U*mu/fvc::grad(p) ;
^
darcyFoam.dep:531: die Regel für Ziel „Make/cygwin64mingw-w64DPOpt/darcyFoam.o“ scheiterte
make: *** [Make/cygwin64mingw-w64DPOpt/darcyFoam.o] Fehler 1

Could you please help me?
Regards.
anuja is offline   Reply With Quote

Old   July 17, 2015, 08:21
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Could you post a few lines of context? How k is defined for example?

Also, what is wrong with pimpleFoam (or simpleFoam in case of steady-state problems) + explicitPorositySource? I.e. why do you need to create darcyFoam?
alexeym is offline   Reply With Quote

Old   July 17, 2015, 08:42
Default
  #3
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Hi thanks for your reply.
Actually I need to create a solver for transient flow with porous media .
I am new to OpenFoam so I was just learning how to create user defined variables. I need to put the formula for permeability from Darcy's law which is:
k=U*mu/delta(p)
I don't know how to put it in the .C file . I have typed the following but I get an error.
k = -U*mu/grad(p)
error:
/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvcGrad.C:159:1: note: ‘Foam::fvc::grad’
grad

What do I do?
Also can you suggest me which slover I should begin with for my case (transient,incompressible,laminar,porous flow)?
With regards.
anuja is offline   Reply With Quote

Old   July 17, 2015, 08:49
Default
  #4
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Sorry I typed the wrong formula

Formula:
k = -U*mu/fvc::grad(p)

error:
/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/zeroI.H:72:13: note: template argument deduction/substitution failed:
darcyFoam.C:64:24: note: cannot convert ‘Foam:perator*(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&, const Foam::dimensioned<double>&) [with Type = Foam::Vector<double>; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]((*(const Foam::dimensioned<double>*)(& mu)))’ (type ‘Foam::tmp<Foam::GeometricField<Foam::Vector<doubl e>, Foam::fvPatchField, Foam::volMesh> >’) to type ‘const Foam::zero&’
k = -U*mu/fvc::grad(p) ;
^
darcyFoam.dep:531: die Regel für Ziel „Make/cygwin64mingw-w64DPOpt/darcyFoam.o“ scheiterte
make: *** [Make/cygwin64mingw-w64DPOpt/darcyFoam.o] Fehler 1
anuja is offline   Reply With Quote

Old   July 17, 2015, 09:25
Default
  #5
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

I guess darcyFoam.C was derived from certain standard solver, which solver did you use? Also I will repeat question from last message: how do you declare variable k? Particularly what is the type of k? Also in general you calculate gradient of pressure caused by porosity from velocity and permeability, not vice versa.

If you need to simulate transient incompressible laminar flow through porous media, I would suggest you pimpleFoam solver. Since it is quite general, you have to specify "simulationType laminar" in constant/turbulenceProperties to exclude calculation of turbulence. To add drag term in momentum equation, you should use explicitPorositySource (see src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H for explanation or tutorials/compressible/rhoPimplecFoam/angledDuct/system/fvOptions for example). To estimate Darcy-Forchheimer coefficients you can use Kozeny-Carman or Ergun equations (or any other relations if they describe behaviour of your porous media better).
alexeym is offline   Reply With Quote

Old   July 17, 2015, 09:33
Default
  #6
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Hi Thanks a lot

k is the permeability which I need as an output variable. I will follow your instructions and try using the pimpleFoam solver. But in that also I will have to put the equation for permeability. So what should I do then?
anuja is offline   Reply With Quote

Old   July 17, 2015, 11:44
Default
  #7
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

pimpleFoam + fvOption solution assumes constant permeability. So you take piece of paper, pen/pencil, Kozeny-Carman formula and calculate permeability

If you need varying permeability (or better to say porosity), you can create your own fvOption. But since you still did not manage to answer the question about variable k, guess, it will not be easy.
alexeym is offline   Reply With Quote

Old   July 21, 2015, 04:41
Default
  #8
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Hi
Yes my case is for anispotropic permeability. For that do I also need to set the Create Zones file (like is there for rhoPimpleFoam) ?
Thanks a lot for your help.
anuja is offline   Reply With Quote

Old   July 21, 2015, 09:00
Default
  #9
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

There is no connection between anisotropy and cell zones. You need cell zone if your porous area is only part of the mesh. For anisotropy you have d and f as vectors (if you choose Darcy-Forchheimer model) and rotation of coordinate system set by e1 and e2 vectors (you can find equations used to transform vectors d and f into tensors D and F in $FOAM_SRC/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C).
alexeym is offline   Reply With Quote

Old   July 21, 2015, 09:08
Default
  #10
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Hello,
Could you please tell me how do I solve a porous media problem (Darcy Forschheimer equation) here. Also how do I set Permeability as the output?

As per my knowledge permeability K=1/d (darcy's constant)
How do I define this as my output variable?
anuja is offline   Reply With Quote

Old   July 21, 2015, 10:14
Default
  #11
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Unfortunately I do not understand what is blocking you for running pimpleFoam (with fvOptions set up using tutorial example). I have posted all keywords and necessary files to get you started.
alexeym is offline   Reply With Quote

Old   July 21, 2015, 10:24
Default
  #12
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Hi,
Yes I have understood completely what you have explained. The only problem I have right now is that I want to view the results in terms of anisotropic permeability . For that I do not know yet how to define the user defined variable for permeability (K).
Thanks again for your help
anuja is offline   Reply With Quote

Old   July 21, 2015, 12:42
Default
  #13
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Since
  • calculation of permeability is something you have to decide on, I have mentioned Kozeny-Carman and Ergun equations, guess there are analogous relations for anisotropic porosity
  • in current implementation of Darcy-Forchheimer model in OpenFOAM, permeability is constant (well, it can be different in different cell zones), so you need to calculate just two constants, and there is no reason to use OpenFOAM for these calculations
  • problem of permeability calculation has nothing to do with OpenFOAM

I will withdraw myself from conversation.
alexeym is offline   Reply With Quote

Old   August 5, 2015, 03:12
Default
  #14
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Hi,
I have a question regarding the effects of fiber angle orientation now.Can you please tell me how to consider the fibre orientation while solving a case for porousInterFoam from the tutorials? For example with fibre angle of 0 degrees.
Thanks in advance!
regards.
anuja is offline   Reply With Quote

Old   August 5, 2015, 04:27
Default
  #15
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

You have global coordinate system, you have local coordinate system of porous area, that is defined in DarcyForchheimerCoeffs:

Code:
    DarcyForchheimerCoeffs
    {
        ...
        coordinateSystem
        {
            type    cartesian;
            origin  (0 0 0);
            coordinateRotation
            {
                type    axesRotation;
                e1      (0.70710678 0.70710678 0);
                e2      (0 0 1);
            }
        }
    }
If there is no rotation of pores (guess, this is what you have meant by "fibre angle of 0 degrees"), local and global coordinate systems should have the same basis vectors, so e1 is (1 0 0) and e2 is (0 1 0).

The answer is just a guess, cause question does not contain any context about "fibre".
alexeym is offline   Reply With Quote

Old   August 5, 2015, 04:33
Default
  #16
New Member
 
as
Join Date: Jul 2015
Posts: 19
Rep Power: 10
anuja is on a distinguished road
Thanks a lot for your reply.
I meant was for the following details how to program the solver file .

layer 1
fiberVolFraction 0.55
fiberAngle 0

layer 2
fiberVolFraction 0.55
fiberAngle 90

So for this case how to write the file ?
Do I also need to modify the solver PorousInterFoam to consider the effects of fiber angle?
Regards!
anuja 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
ADDITIONAL VARIABLES LIMITERS N.P CFX 5 December 1, 2011 07:47
$FOAM_USER_APPBIN & LIBBIN variables not set rassilon OpenFOAM Installation 2 February 16, 2010 20:54
User Defined Scalars - Returning Values Carlos V. FLUENT 0 April 19, 2006 18:18
PHI file structure Eugene Phoenics 9 November 2, 2001 22:00
Saving variables on a user patch with physical coordinates Zoltan Turzo CFX 2 April 20, 2000 15:05


All times are GMT -4. The time now is 11:20.