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

Adding Electric Equation to interFoam (OF 2.3.0)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 9, 2016, 06:20
Default
  #1
New Member
 
mehran
Join Date: Jul 2016
Posts: 5
Rep Power: 9
mehranism is on a distinguished road
Dear Foamers,
This is my first thread,so i'll be thankful for any advices.

in order to add electric equations to interFoam i need to add epsilon(permitivity) and KE(electric conductivity) to incompressible two phase mixture. these are two phase variables like density.
my problem is in Modifcation of the library section.
i read all of this thread "http://www.cfd-online.com/Forums/openfoam-programming-development/162577-adding-energy-equation-interfoam-2-4-0-a.html" and used it but it didn't help to solve my case. I am going to describe my steps in detail in this thread like that one:

1)
Copy the original folder transportModels to the user's directory

cd $WM_PROJECT_USER_DIR/src/
cp -rp $FOAM_SRC/transportModels .

2)
Rename the folders and files which are being modified (namely the librariy incompressibleTwoPhaseMixture)

cd transportModels/incompressible
mv incompressibleTwoPhaseMixture myIncompressibleTwoPhaseMixture
cd myIncompressibleTwoPhaseMixture
mv incompressibleTwoPhaseMixture.C myIncompressibleTwoPhaseMixture.C
mv incompressibleTwoPhaseMixture.H myIncompressibleTwoPhaseMixture.H
3)
Change the respective file files corresponding to the the naming and path.
in the folder incompressible/Make for myIncompressibleTwoPhaseMixture:
Code:
myIncompressibleTwoPhaseMixture/myIncompressibleTwoPhaseMixture.C
LIB = $(FOAM_USER_LIBBIN)/libmyIncompressibleTransportModels
4) Make sure the newly named files are being included with their new name in the respective files:
in myIncompressibleTwoPhaseMixture.C:
Code:
#include "myIncompressibleTwoPhaseMixture.H"


5)
Add the new parameters epsilon and KE in myIncompressibleTwoPhaseMixture.H.
Code:
////////////////Modified///////////////////
dimensionedScalar KE1_;
dimensionedScalar KE2_;

dimensionedScalar epsilon1_;
dimensionedScalar epsilon2_;
///////////////END////////////////////////
and
/////////////////////////Modified////////////////////////////////////
//- Return const-access to phase1 permitivity
const dimensionedScalar& epsilon1() const
{
return epsilon1_;
};
//- Return const-access to phase2 permitivity
const dimensionedScalar& epsilon2() const
{
return epsilon2_;
};
//- Return const-access to phase1 elctric conductivity
const dimensionedScalar& KE1() const
{
return KE1_;
};
//- Return const-access to phase2 electric conductivity
const dimensionedScalar& KE2() const
{
return KE2_;
};
//////////////////////End////////////////////////////////////////


6)
In myIncompressibleTwoPhaseMixture.C add the operations for the new parameters.
Code:
////////added/////////////////////////////
KE1_("KE", dimensionSet(-1,-3, 3, 0, 0, 2, 0), nuModel1_->viscosityProperties().lookup("KE")),
KE2_("KE", dimensionSet(-1, -3, 3, 0, 0, 2, 0), nuModel2_->viscosityProperties().lookup("KE")),

epsilon1_("epsilon", dimensionSet(-1, -3, 4, 0, 0, 2, 0), nuModel1_->viscosityProperties().lookup("epsilon")),
epsilon2_("epsilon", dimensionSet(-1, -3, 4, 0, 0, 2, 0), nuModel2_->viscosityProperties().lookup("epsilon")),
///////////end////////////////////////////////
and

Code:
nuModel2_->viscosityProperties().lookup("rho") >> rho2_;
//-----------modified_start--------------------//
nuModel1_->viscosityProperties().lookup("KE") >> KE1_;
nuModel2_->viscosityProperties().lookup("KE") >> KE2_;

nuModel1_->viscosityProperties().lookup("epsilon") >> epsilon1_;
nuModel2_->viscosityProperties().lookup("epsilon") >> epsilon2_;
//-----------modified_end----------------------//

Also add the lines for the calculation of kE and epsilon.
Code:
// * * * * * * * * * * * * * * calculate the KE & epsilon * * * * //
Foam::tmp<Foam::volScalarField>
Foam::myIncompressibletwoPhaseMixture::KE() const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);

return tmp<volScalarField>
(
new volScalarField
(
"KE",
limitedAlpha1*KE1_
+ (scalar(1) - limitedAlpha1)*KE2_
);
}


Foam::tmp<Foam::volScalarField>
Foam::myIncompressibletwoPhaseMixture::epsilon() const
{
const volScalarField limitedAlpha1
(
min(max(alpha1_, scalar(0)), scalar(1))
);

return tmp<volScalarField>
(
new volScalarField
(
"epsilon",
limitedAlpha1*epsilon1_
+ (scalar(1) - limitedAlpha1)*epsilon2_
);
}

// * * * * * * * * * * * * * * end * * * * * * * * * * * * * * //


7)
Compile the library from the respective folder.

cd incompressible
wclean
wmake libso
........
files are attached below:

Last edited by mehranism; July 10, 2016 at 06:40.
mehranism is offline   Reply With Quote

Old   July 9, 2016, 06:22
Default
  #2
New Member
 
mehran
Join Date: Jul 2016
Posts: 5
Rep Power: 9
mehranism is on a distinguished road
i did this and I got the following output log:

..
..
..
myIncompressibleTwoPhaseMixture/myIncompressibleTwoPhaseMixture.C:166:45: error: no ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::myIncompressibleTwoPhaseMixture::KE() const’ member function declared in class ‘Foam::myIncompressibleTwoPhaseMixture’
Foam::myIncompressibleTwoPhaseMixture::KE() const
^
myIncompressibleTwoPhaseMixture/myIncompressibleTwoPhaseMixture.C:186:50: error: no ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::myIncompressibleTwoPhaseMixture::epsilon() const’ member function declared in class ‘Foam::myIncompressibleTwoPhaseMixture’
Foam::myIncompressibleTwoPhaseMixture::epsilon() const
^
make: *** [Make/linux64GccDPOpt/myIncompressibleTwoPhaseMixture.o] Error 1

any idea to solve this?

Last edited by mehranism; July 9, 2016 at 17:50.
mehranism is offline   Reply With Quote

Old   July 9, 2016, 18:52
Default
  #3
New Member
 
mehran
Join Date: Jul 2016
Posts: 5
Rep Power: 9
mehranism is on a distinguished road
i solved that error...
mehranism 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
Setting the height of the stream in the free channel kevinmccartin CFX 12 October 13, 2022 21:43
interface smearing. InterFoam, OpenFOAM 2.3.0 and higher vagnerserge OpenFOAM Running, Solving & CFD 4 February 4, 2019 07:56
adding energy equation to interFoam Elham OpenFOAM Programming & Development 11 January 29, 2017 14:14
Adding temperature to interFoam, openFOAM version 2.3.0 abdessamad OpenFOAM Programming & Development 0 May 9, 2014 08:27
Adding an Acoustic Equation Prateep Chatterjee FLUENT 0 June 2, 2000 10:22


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