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

OpenFOAM 1D solver

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By nimasam

Reply
 
LinkBack Thread Tools Display Modes
Old   April 18, 2012, 16:40
Default OpenFOAM 1D solver
  #1
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 206
Rep Power: 9
nandiganavishal is on a distinguished road
Dear Foamers,

I would like to solve a poisson equation in a simple 1D domain (6 units) using OpenFOAM. I have created a blockmesh file and ensured the XY and XZ patches are defined as empty.

See below


convertToMeters 1e3;

vertices
(
(0 0 0) //0
(6 0 0) //1
(6 0.1 0) //2
(0 0.1 0) //3
(0 0 0.1) //4
(6 0 0.1) //5
(6 0.1 0.1) //6
(0 0.1 0.1) //7
);

blocks
(
hex (0 1 2 3 4 5 6 7) (600 1 1) simpleGrading (1 1 1)
);

edges
(
);

patches
(
patch inlet
(
(0 4 7 3)
)
patch outlet
(
(1 5 6 2)
)

empty frontAndBack
(
(0 1 5 4)
(3 2 6 7)
(0 1 2 3)
(4 5 6 7)
)
);

mergePatchPairs
(
);


Now I would like to solve poisson equation with different source terms at different regions in the 1D domain. For instance for the aforementioned example I would like to solve

d^2T/dx^2 = a/R for 0<= x<2000
d^2T/dx^2 = a+b/R for 2000<= x <=4000
d^2T/dx^2 = a/R for 4000< x<=6000

I have looked at know how to implement the laplacian solver and define the source terms. But I would like to know how to define the source term by considering the domain. Kindly let me know.

Thanks for the help.

Regards
Vishal Nandigana
nandiganavishal is offline   Reply With Quote

Old   April 19, 2012, 01:22
Default
  #2
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
it seems easy! your general equation is laplacian(T) = Q
and your source temr (Q) is non-uniform! then you just need to define this non-uniform volScalarField Q some like this:
forAll (Q, celli){
if (Q[celli].x() < 2000){ Q[celli] =a/R }
if ( 2000<Q[celli].x() < 4000 ) {...}
if ( 4000<Q[celli].x() < 6000 ) {...}
}

i hope you get the idea
mm.abdollahzadeh likes this.
nimasam is offline   Reply With Quote

Old   April 19, 2012, 11:29
Default
  #3
Senior Member
 
Vishal Nandigana
Join Date: Mar 2009
Location: Champaign, Illinois, U.S.A
Posts: 206
Rep Power: 9
nandiganavishal is on a distinguished road
Thanks for the reply.

It works.

Vishal
nandiganavishal is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenCL linear solver for OpenFoam 1.7 (alpha) will come out very soon qinmaple OpenFOAM Announcements from Other Sources 4 August 10, 2012 11:00
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
Running Problem using Openfoam solver cfd_staruser OpenFOAM 5 August 14, 2009 02:28
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 05:56
OpenFOAM Training and Workshop Zagreb 2628Jan2006 hjasak OpenFOAM 1 February 2, 2006 22:07


All times are GMT -4. The time now is 09:35.