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

modification of pisoFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 13, 2016, 04:03
Default modification of pisoFoam
  #1
Senior Member
 
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11
sinatahmooresi is on a distinguished road
hi friends!
i want to add in concentration fields (S) and temperature(T) in to pisoFoam and i also i want to define a new formula for calculation of rho that is function of both S,T that is named Mille and Poisson (1981) equation of density. so i want to define this in pisoFoam.c and i compile it . and another changing is to a modification in momentum equation. so i did these to pisofoam.c and also i introduced S , T to creatField.H .

in pisoFoam.c:

rho==1000;
rho==(rho/1000*(999.842594+6.793952e-2*T-(9.095290e-3*pow(T,2))+
(1.001685e-4*pow(T,3))-(1.120083e-6*pow(T,4))+(6.536336e-9*pow(T,5))+
S*(8.24493e-1-4.0899e-3*T+(7.6438e-5*pow(T,2))-(8.2467e-7*pow(T,3))+
(5.3875e-9*pow(T,4)))+(pow(S,1.5))*(-5.72466e-3+1.0227e-4*T-1.6546e-6*pow(T,2))+S*(4.8314e-4)));


and in momentum equation:
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
-g*(rho-1000)/1000
);

UEqn.relax();


fvScalarMatrix SEqn
(
fvm::ddt(rho, S)
+ fvm::div(rhophi, S)
- fvm::laplacian(kappaEff, S)
);

SEqn.relax();
SEqn.solve();

fvScalarMatrix TEqn
(
fvm::ddt(rho, T)
+ fvm::div(rhophi, T)
- fvm::laplacian(kappaEff, T)
);

TEqn.relax();
TEqn.solve();

so when i want to compile this, i face with some errors:

my_pisoFoam.C:65:2: error: ‘rho’ was not declared in this scope
my_pisoFoam.C:76:16: error: ‘g’ was not declared in this scope
my_pisoFoam.C:91:26: error: ‘rhophi’ was not declared in this scope
my_pisoFoam.C:92:32: error: ‘kappaEff’ was not declared in this scope

i should say that i changed the name of modified solver to my_pisoFoam.
i know that in creatField.H of pisoFoam there is now any definition of "transport properties" and for exapmle kappaEff is one of constants that i introduced in transport properties directory like others that are in this directoru by defaults. i hope to my friends in FOAM can understand my question well!!!
all the bests
thank u all
sinatahmooresi is offline   Reply With Quote

Old   April 14, 2016, 00:41
Default
  #2
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Hi sina,

Please attach your solver.
rapierrz is offline   Reply With Quote

Old   April 14, 2016, 14:04
Default
  #3
Senior Member
 
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11
sinatahmooresi is on a distinguished road
hi friend!
i attached my modified solver to this reply
any help is appreciated.
thank u
Attached Files
File Type: gz my_pisoFoam (copy).tar.gz (167.7 KB, 12 views)
sinatahmooresi is offline   Reply With Quote

Old   April 15, 2016, 01:45
Smile
  #4
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Quote:
Originally Posted by sinatahmooresi View Post
hi friend!
i attached my modified solver to this reply
any help is appreciated.
thank u
In your code,you don't define rho,rhoPhi,kappaEffec,... in createField.H.

You must define every variable that use in your code in createField or in

.C file.

And you should call gravitationalAcceleration.H in your headers for g.
rapierrz is offline   Reply With Quote

Old   April 15, 2016, 13:44
Default
  #5
Senior Member
 
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11
sinatahmooresi is on a distinguished road
Hi rapierrz!
i added #include "readGravitationalAcceleration.H" to fix problem of "g" and i added "Reading transportProperties\n" to fix problem of "kappaEff" and i added :
surfaceScalarField rhoPhi
(
IOobject
(
"rho*phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
linearInterpolate(rho) * phi
);

to fix "rhophi" problem .
i copied that rhophi from creatField.H of inetrFoam solver
so i compiled the solver again and the only error masege that i faced is :
make: *** [Make/linux64GccDPOpt/my_pisoFoam.o] Error 1
and as u saw the solver i defined "S" and "T" fields and it is conventional to reading fields at first like
reading field P
reading field U ,...
so i'm expecting to see reading field S and T
but it doesn't occur unfortunately !
i attached it again
thanks for your guidance
sinatahmooresi is offline   Reply With Quote

Old   April 15, 2016, 13:59
Default attachment of previous reply!
  #6
Senior Member
 
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11
sinatahmooresi is on a distinguished road
i missed to attach solver in previous reply
sinatahmooresi is offline   Reply With Quote

Old   April 15, 2016, 14:02
Default
  #7
Senior Member
 
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11
sinatahmooresi is on a distinguished road
i think there is a problem to attachment ! i'm trying my_pisoFoam (copy).tar.gz
sinatahmooresi is offline   Reply With Quote

Old   April 15, 2016, 15:53
Smile
  #8
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Quote:
Originally Posted by sinatahmooresi View Post
Hi rapierrz!
i added #include "readGravitationalAcceleration.H" to fix problem of "g" and i added "Reading transportProperties\n" to fix problem of "kappaEff" and i added :
surfaceScalarField rhoPhi
(
IOobject
(
"rho*phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
linearInterpolate(rho) * phi
);

to fix "rhophi" problem .
i copied that rhophi from creatField.H of inetrFoam solver
so i compiled the solver again and the only error masege that i faced is :
make: *** [Make/linux64GccDPOpt/my_pisoFoam.o] Error 1
and as u saw the solver i defined "S" and "T" fields and it is conventional to reading fields at first like
reading field P
reading field U ,...
so i'm expecting to see reading field S and T
but it doesn't occur unfortunately !
i attached it again
thanks for your guidance
Hi sina,

Please,put your full error massage.
rapierrz is offline   Reply With Quote

Old   April 16, 2016, 02:05
Default
  #9
Senior Member
 
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11
sinatahmooresi is on a distinguished road
Hi rapierrz,
that error message that i put here is the last line of compiling! and before it there is some warning messages that I've seen in other compilation before. in this case before the last line that it contains the error some lines are :

/opt/openfoam221/src/OpenFOAM/lnInclude/VectorSpaceI.H:634:13: note: template<class Form, class Cmpt, int nCmpt> bool Foam:perator==(const Foam::VectorSpace<Form, Cmpt, nCmpt>&, const Foam::VectorSpace<Form, Cmpt, nCmpt>&)
/opt/openfoam221/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable]
/opt/openfoam221/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/my_pisoFoam.o] Error 1
thanks for your attentions
sinatahmooresi is offline   Reply With Quote

Old   April 16, 2016, 02:45
Smile
  #10
Senior Member
 
Hesam
Join Date: Feb 2015
Posts: 139
Rep Power: 11
rapierrz is on a distinguished road
Hi sina,

In your code,there are a lots of errors and ill defined parameters.

before you start to write your own code,you should start with simple case

such as add temperature to icoFoam:

https://openfoamwiki.net/index.php/H...ure_to_icoFoam

with this manner you can add S and T fields to your code.

also,you should read about units and mathematical operators in openfoam.

good luck.
rapierrz is offline   Reply With Quote

Old   April 16, 2016, 04:11
Default
  #11
Senior Member
 
CFD_Lovers
Join Date: Mar 2015
Posts: 168
Rep Power: 11
sinatahmooresi is on a distinguished road
Hi friend
actually i read that one (how to add temperature field to icoFoam) i'm learnig FOAM. bur as u read the code before! was it full of ill defined parameters and so on ?!!
thanks a lot for your attentions
sinatahmooresi 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
Differences in solution method for pisoFoam and buoyantBoussinesqPisoFoam mchurchf OpenFOAM 7 August 6, 2023 09:12
How can I get stedaystate solution from pisoFoam? mykkujinu2201 OpenFOAM Running, Solving & CFD 1 December 8, 2015 07:37
Porosity model not found for pisoFoam; works fine for simpleFoam aerogt3 OpenFOAM 2 September 13, 2014 16:39
pisoFoam, pimpleFoam - Fluent user's questions RodriguezFatz OpenFOAM Running, Solving & CFD 0 September 4, 2013 04:26
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18


All times are GMT -4. The time now is 05:53.