CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Creating a New U_a, U_b (https://www.cfd-online.com/Forums/openfoam-programming-development/117796-creating-new-u_a-u_b.html)

RaghavendraRohith May 15, 2013 07:26

Creating a New U_a, U_b
 
Hi ,

Is it possible to implement new variable for example Ua, Ub in the place of U and change all the necessary .h header files in accordance with the new change velocity names Ua and Ub. I have seen such in multiphase flow but i am not intersted in it. It is to solve two flow with two momentum equations in a system(mesh).

Lieven May 15, 2013 09:12

Hi Rohith and welcome to the forum ;-)

I don't fully understand the question you're asking cause the answer is a bit in it. Yes it is possible to solve for Ua and Ub simply if you change everything accordingly as you suggest yourself.

Cheers,

L

RaghavendraRohith May 15, 2013 14:29

Hmm
 
Hi Mr.Leiven


The problem actually is i need to solve two momentum and two impulse equations in a system with two different fluids(liq1 and liq 2) and thier physical properties. There is no contact between the fluids in mesh and in reality.

Where the case i described before is a multiphase or a dispersed phase flow where the Ua and Ub are balanced by a volume fraction in U. My intention is to solve

1. Ua,pa ----mometum equation1.
2. ub, pb --- mom. eq 2

In this case i need to create two U and p files in the boundary conditions(0) file and two different schemes. And everything is doubled..


Thanks in Advance
Rohith

RaghavendraRohith May 16, 2013 09:56

Hi
 
Hi

My intention is to change the declaration of variable U in the roots of the code with other name U_a and p with p_a .


Can somebody state where the declaration of the initial file for U and p are present. Declaration means declaration of U and p as some character.

i can declare U a and p a in the same file, in the way u and p are declared.

They are linked with almost all the million files in OpenFOAM. i wanted to use a logic to handle them for my CFD problem

Regards
rohith

Lieven May 16, 2013 10:13

Hi Rohith,


I'm still trying to understand what you want to achieve. If the fluids are not in contact with each other. Why wouldn't you simply run two independent simulations?

The name of the files is usually set in "createFields.H" of the solver. Search for IOobject("U", ...) and change it to IOobject("U_a",...) . Changing the name of the variable U to U_a is also possible and the only files you need to change for that are the files of the solver. But again, why not running 2 simulations?

Cheers,

L

RaghavendraRohith May 16, 2013 10:22

Hi
 
I have done the above case but lot of files like

fvCFD.H,single transport.H, etc., all know only U and p.

This problem goes to the editing the root files


The main issue is the two fluids are not in contact but there is 4 electron transfer between them. The main issue here is the flow of these two fluids is perpendicular to each other ,but they are not in contact.

OpenFOAM just knows that U = Velocity
p = pressure


But in my problem i will not solve one navier stokes equation. I will solve two momentum equations at a time along with two continituty eqns.

kind of tricky but necessary

Thanks
Rohith

Lieven May 16, 2013 10:36

Ok, I'm starting to understand it. So they are not in direct contact with each other but they do influence each other.

Before starting to mess around in the code, you should update your knowledge on object oriented programming a bit. The names of objects in other classes is not related to the names used in the solver itself. For consistency, velocity is usually called U etc. but this is basically a convention. E.g. if you create a 'singlePhaseTransportModel'-object
Code:

singlePhaseTransportModel laminarTransport(U, phi);
or you do it like
Code:

singlePhaseTransportModel laminarTransport(U_a, phi);
the code of the singlePhaseTransportModel-class does not need to change at all, it can still refer to the velocity as 'U'.

I hope this helps you a bit.

Cheers,

L

RaghavendraRohith May 16, 2013 10:41

So you mean the definition links it to the desired path and the solver automatically. Ok then

Can i use two U_a and U_b by using a recurssive loop in any data file.? eg : createporousZones or create fields or in solver.C file?

in each file.?

Thanks

Rohith

RaghavendraRohith May 21, 2013 08:09

Hi L

I tried to eradicate all the errors but the problem in compiling a solver which solves two momentum and two continuity equations is still there. I tried to compile it but the major problem comes with calling singlePhaseTransportModel again and again. As in my case the flow is individually single phase even if there are two fluids.

I can send you the file if needed.

thanks
rohith

Lieven May 21, 2013 08:20

Hi Rohith,


Feel free to post the code here or to send it to me in private. Whatever you like. I'll have a look at it at my earliest convenience.

Cheers,

L

RaghavendraRohith May 21, 2013 09:15

Hi
 
2 Attachment(s)
Here is the file for singlephase transport and the solver file where i was trying to compute two mometum equations.


Thanks
rohith

Lieven May 21, 2013 10:36

Hi Rohith,


I'm a bit confused with your "#include "singlePhaseTransportModela.H"" statements. Why not use
Code:

#include "singlePhaseTransportModel.H"
in my_porousSimpleFoam.C

and define
Code:

singlePhaseTransportModel laminarTransporta(Ua, phia);
singlePhaseTransportModel laminarTransportb(Ub, phib);

which in its turn you should use in
Code:

autoPtr<incompressible::RASModel> turbulencea
(
    incompressible::RASModel::New(Ua, phia, laminarTransporta)
);
autoPtr<incompressible::RASModel> turbulenceb
(
    incompressible::RASModel::New(Ub, phib, laminarTransportb)
);

Make sure you also have defined "createPhia.H" and "createPhib.H" yourself cause else you will also get an error on these files.

Cheers,

L

RaghavendraRohith May 21, 2013 11:26

Hi Lieven

I have tried it before but the execution of the file is done but it shows iofatal error when the run the problem by using the compiled solver


"ill defined primitiveEntry starting at keyword 'value' on line 52 and ending at line 69

Which drives the problem to primitve entry io.h file

i am looking through the problem give me asuggestion if you have an idea to solve this.


Your suggestions were really helpful.

Thanks a lot

rohith

Lieven May 21, 2013 12:16

This error is not related to the solver. It is probably due to a boundary condition that is missing a 'value' entry or where the 'value' entry is incorrectly defined.

Cheers,

Lieven

RaghavendraRohith May 21, 2013 12:31

Ya i found it....

But there are still new problems arising,

Thanks a lot lieven

rohith

RaghavendraRohith May 24, 2013 09:53

Hi leiven


Code:


leFoam
Make/linux64GccDPOpt/my_porousSimpleFoam.o: In function `main':
my_porousSimpleFoam.C:(.text+0x17dd): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<Foam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C:(.text+0x18ad): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<Foam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C:(.text+0x274d): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<Foam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C:(.text+0x28ed): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<Foam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C:(.text+0x32a6): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<Foam::Vector<double> >&) const'
my_porousSimpleFoam.C:(.text+0x336e): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<Foam::Vector<double> >&) const'
my_porousSimpleFoam.C:(.text+0x4fe6): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<Foam::Vector<double> >&) const'
my_porousSimpleFoam.C:(.text+0x50a6): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<Foam::Vector<double> >&) const'
collect2: ld gab 1 als Ende-Status zurück
make: *** [/home/kasibhat/OpenFOAM/kasibhat-2.1.1/platforms/linux64GccDPOpt/bin/my_porousSimpleFoam] Fehler 1

I have tried to eliminate all the errors in my solver and make it work. but what is this , how can i solve this


thanks

rohith

RaghavendraRohith May 28, 2013 08:01

Hi
 
Hi Leiven

The same below problem appears after including all files in options file and copying all files in the appropriate folders





[CODE]

leFoam
Make/linux64GccDPOpt/my_porousSimpleFoam.o: In function `main':
my_porousSimpleFoam.C.text+0x17dd): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<F oam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C.text+0x18ad): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<F oam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C.text+0x274d): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<F oam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C.text+0x28ed): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<F oam::Vector<double> > const&, Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>&, bool) const'
my_porousSimpleFoam.C.text+0x32a6): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<F oam::Vector<double> >&) const'
my_porousSimpleFoam.C.text+0x336e): undefined reference to `Foam::porousZone::addResistanceb(Foam::fvMatrix<F oam::Vector<double> >&) const'
my_porousSimpleFoam.C.text+0x4fe6): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<F oam::Vector<double> >&) const'
my_porousSimpleFoam.C.text+0x50a6): undefined reference to `Foam::porousZone::addResistancea(Foam::fvMatrix<F oam::Vector<double> >&) const'
collect2: ld gab 1 als Ende-Status zurück
make: *** [/home/kasibhat/OpenFOAM/kasibhat-2.1.1/platforms/linux64GccDPOpt/bin/my_porousSimpleFoam] Fehler 1
/CODE]

thanks

rohith


All times are GMT -4. The time now is 04:39.