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

new direct mapped programming bc directmapped

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 27, 2011, 09:54
Default new direct mapped programming bc directmapped
  #1
Senior Member
 
Join Date: Apr 2009
Location: Karlsruhe, Germany
Posts: 103
Rep Power: 17
Thomas Baumann is on a distinguished road
Hallo Foamers,

I'm simulating channel and pipe flows using LES with forced convection and heat transfer. I have modified pisoFoam to solve four temperature-equations for four different molecular Prandtl numbers. As wall boundary condition I'm using a fixed gradient. So the medium is getting warmer over the time.

For cycling the velocity I'm using the directMapped bc. But I don't want that my temperature is growing in the inlet and so I have implemented a boundary condition that solves that without using directMapped:
T_inlet = T_outlet- deltaT. And deltaT is a fixed value that I have determined. This one works but I have problems using many processors. So I'm trying to program a new directMappedbc where I can use deltaValue instead of average.

I made a new bc with the name moddirectMappedFixedValue and compiled dynamically the origin directMapped using wmake libso as discribed in the wiki. It works, I can select it as boundary condition, but when I'm solving an easy validation case I get following error:


Create mesh for time = 0

Reading field T1

pisoTempFoam: symbol lookup error: /user/hi204/OpenFOAM/hi204-1.7.0/lib/linux64GccDPOpt/libmoddirectMappedFixedValueFvPatchField.so: undefined symbol: _ZN4Foam37moddirectMappedFixedValueFvPatchFieldIdE C1ERKNS_7fvPatchERKNS_16DimensionedFieldIdNS_7volM eshEEERKNS_10dictionaryE


I'm not an expert of C++. So it would be very kind if someone could help me.

Best regards, Thomas
Thomas Baumann is offline   Reply With Quote

Old   May 28, 2011, 22:27
Default
  #2
Senior Member
 
N/A
Join Date: Mar 2009
Posts: 189
Rep Power: 17
harishg is on a distinguished road
Did you compile it in user folder or within the original boundary condition folder? If you did the former, you need to add

libs("whatevername.so") to your system/controldict
harishg is offline   Reply With Quote

Old   May 30, 2011, 06:00
Default
  #3
Senior Member
 
Join Date: Apr 2009
Location: Karlsruhe, Germany
Posts: 103
Rep Power: 17
Thomas Baumann is on a distinguished road
Thank you very much for the answer.

I compiled it dynamically. So I had to include libs("whatevername.so") to your system/controldict

So when I'm solving the test case I don't get the error that the new boundary type can't be found, it's an error while using the new boundary type.

Here you can download the code for the boundary-condition
http://www-isl.mach.uni-karlsruhe.de/~hi204/OpenFoam_Forum/newbc

Regards, Thomas
Thomas Baumann is offline   Reply With Quote

Old   May 30, 2011, 11:02
Default
  #4
Senior Member
 
N/A
Join Date: Mar 2009
Posts: 189
Rep Power: 17
harishg is on a distinguished road
For some reason the linker is not able to look up for the BC while running the solver. You can try recompiling OpenFOAM by running wclean and wmake. Another temporary fix is to copy the boundary conditions files into your solver folder and recompile the solver: http://www.tfd.chalmers.se/~hani/kur...yCondition.pdf

and see if it works for now.
harishg is offline   Reply With Quote

Old   June 1, 2011, 05:46
Default
  #5
Senior Member
 
Join Date: Apr 2009
Location: Karlsruhe, Germany
Posts: 103
Rep Power: 17
Thomas Baumann is on a distinguished road
Hi,

thanks again. But that was not the problem. But I solved it now.
I had to include in the moddirectMappedFixedValueFvPatchField.H data:

#ifdef NoRepository
# include "moddirectMappedFixedValueFvPatchField.C"
#endif


and change that
moddirectMappedFixedValueFvPatchField.C is not included in the files data.

Than I changed
setAverage_ to setHeating_

and

average_ to heating_

and I changed in the moddirectMappedFixedValueFvPatchField.C:
if (setHeating_)
{
Type heatingPsi =
gSum(this->patch().magSf()*newValues)
/gSum(this->patch().magSf());
newValues += heating_;
/*if (mag(heatingPsi)/mag(heating_) > 0.5)
{
newValues *= mag(heating_)/mag(heatingPsi);
}
else
{
newValues += (heating_ - heatingPsi);
}*/
}


and changed in the moddirectMappedFixedValueFvPatchField.H
TypeName("moddirectMapped");


now I can use for example:
inletpatch
{
value uniform 300;
type moddirectMapped;
setHeating on;
heating -176.249998;
}

and it works without any problems until now

Regards Thomas
Thomas Baumann is offline   Reply With Quote

Old   June 6, 2011, 12:53
Default directMapped bc for temperature
  #6
Member
 
David
Join Date: Dec 2009
Location: Spain
Posts: 62
Rep Power: 16
David_010 is on a distinguished road
Hi Thomas,

First of all tanks for your attention. I have been using the directMapped b.c for the temperature field, with a fixed heat flux at the wall of a duct. In my case, I need to have the same average temperature at the inlet, because if I use a fixed gradient b.c at the wall, I don't know the temperature difference between inlet and outlet at the beginning. So, I impose an average value for the temperature at the inlet, while the temperature profile is the same as at the outlet.


My question is, how can you impose a temperature step between inlet and outlet or, how do you know it?


I have another question. In my problem, laminar flow in a duct with moving devices inside, I get correct results for low Prandtl numbers (e.g air) but the temperature increases a lot and the results are wrong when I tray to solve for high Prandtl numbers (e.g 280). I have thought about numerical diffusion, but may by you know what could be the problem.


Thank you again for your help.


Regards,


David
David_010 is offline   Reply With Quote

Old   June 7, 2011, 14:57
Default
  #7
Senior Member
 
Join Date: Apr 2009
Location: Karlsruhe, Germany
Posts: 103
Rep Power: 17
Thomas Baumann is on a distinguished road
Hi David,

I made a energy-sumation. Thermal Energy which comes in due to the inlet + thermal energy due to the wall heat flux = thermal energy out due to the outlet. So it's only heat balance. Because of I'm simulating a incompressible flow and the viscosity and the molecular Prandtl number etc. are constant I can determine at the beginning the DeltaT value, which the medium will be heated passing the flow regime.

For your other question I don't undersand it. I need more details. What bc's do you use, incompressible, which solver, turbulent..

Best regards

Thomas
Thomas Baumann is offline   Reply With Quote

Old   June 8, 2011, 12:31
Default
  #8
Member
 
David
Join Date: Dec 2009
Location: Spain
Posts: 62
Rep Power: 16
David_010 is on a distinguished road
Hi Thomas,

Thanks a lot for your reply. I've looking for a boundary condition like yours for a long time. I am working in a model of heat exchanger which is a tube (with constant heat flux at the walls) with moving scrapers inside, in order to increase the heat transfer. So, I want to simulate only one pitch of the heat exchanger, and I am using the directMapped b.c for velocity, but I need a b.c like yours for the temperature. How do yo specify the initial temperature at the inlet, or the initial temperature?


My second question was: I have validated the model of the heat exchanger, employing an incompressible, steady and laminar solver (basically buoyantBoussinesqSimpleFoam) for low Prandtl numbers (e.g air properties Pr=0,7). The velocity and temperature profiles are exactly like the analytical ones, and the energy balance is also accomplished. But when I change the properties to a high Prandlt number (e.g propylene glycol Pr=280) the temperature increases to values higher than expected, and the energy balance is not accomplished, with errors about the 80%.


The boundary condition I'm using is a fixedGradient b.c for the temperature at the wall, inlet is uniform with T=300K, and outlet is zeroGradient.


I have thought about a problem of numerical or false diffusion, but the problem continues if I change the numerical scheme (blended, Gamma...).


Thank you very much again for your help, at this point I am a bit lost.


Regards


David
David_010 is offline   Reply With Quote

Old   June 15, 2011, 07:16
Default
  #9
Senior Member
 
Join Date: Apr 2009
Location: Karlsruhe, Germany
Posts: 103
Rep Power: 17
Thomas Baumann is on a distinguished road
Hi David,

I was using as starting condition a constant temperature over the complete field. After a while the temperature field will be developed , too. I can do that, because I use the assumptions that the flow is incompressible and nu Pr ... are constant. With the new bc condition I can cycle the temperature, too. To determine delta T, which I have to add or remove I made a heat balance as descirbed above.

If you have flows with high Prandtl numbers you can get turbulence on the heat side. The critical number is hereby the Peclet number. (Peclet number = molecular Prandtl number* Re)
So here your velocity is due to the diffusivity laminar, but your thermal diffusivity is too low and so you get an thermal instability...
Maybe that could be the problem.

Send me your email adress and I will send zou the code.

Best regards

Thomas

Last edited by Thomas Baumann; June 15, 2011 at 17:54.
Thomas Baumann is offline   Reply With Quote

Old   June 15, 2011, 09:11
Default
  #10
Member
 
Join Date: Oct 2010
Location: Stuttgart
Posts: 35
Rep Power: 15
grandgo is on a distinguished road
Quote:
Originally Posted by Thomas Baumann View Post
Hi David,

I was using any starting condition a constant temperature. I can do that, because the flow is incompressible and nu Pr ... are constant. With the new bc condition I can cylcle the temperature , too. To determine delta T, which I have to add or remove I made a heat balance as descirbed above.

If you have flows with high Prandtl numbers you can get turbulence on the heat side. (Peclet number = molecular Prandtl number* Re)
So here your velocity is due to the diffusivity laminar, but your thermal diffusivity is to low and so you get an thermal instability...
Maybe that could be the problem.

Send me your email adress and I will send zou the code.

Best regards

Thomas

hi thomas,

could you please send me the code of your modified pisoFoam solver? it sounds very interesting to me.

which turbulenceModel are you using?

best regards
grandgo
grandgo is offline   Reply With Quote

Reply

Tags
directmapped bc


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
direct map vs cyclic nimasam OpenFOAM 2 February 15, 2017 11:58
setup problems - LES pipe flow with cyclic BC (1) and direct mapped inlet (2) florian_krause OpenFOAM 22 June 13, 2013 21:25
helmholtzFoam / direct matrix solver mirko OpenFOAM 0 August 2, 2010 03:30
is free meshing or mapped meshing is best for flow problems shanu Main CFD Forum 0 February 18, 2010 11:58
[Other] is free meshing or mapped meshing is best for flow problems shanu OpenFOAM Meshing & Mesh Conversion 0 February 18, 2010 11:56


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