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

uniform Scalar,setFields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2012, 13:01
Default uniform Scalar,setFields
  #1
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
Dear foamers,

I want to define a uniform scalar (e.g alpha) with 0 in some region and 1 otherwise (may use setfields utility). Also, I just want to make these values unchanged when running the code. How to deal with that in the solver?
zxj160 is offline   Reply With Quote

Old   April 23, 2012, 14:29
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Are you trying to use this field as a source term? If you are running OF 2.1 you might be able to use the source term functionality:

http://www.openfoam.org/version2.1.0/numerics.php
mturcios777 is offline   Reply With Quote

Old   April 23, 2012, 14:54
Default
  #3
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
YES. My current code is :

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
==
alpha*gradP
);

I defined gradP as a vector and alpha as a scalar. I want to keep alpha uniform when running as follows:

defaultFieldValues
(
volScalarFieldValue alpha 0
);

regions
(
boxToCell
{
box (0 0 10) (30 10 50);
fieldValues
(
volScalarFieldValue alpha 1
);
}
);
zxj160 is offline   Reply With Quote

Old   April 23, 2012, 15:12
Default
  #4
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Looks like what you have is right, so long as no transport equation is solved for alpha you're in business. Are you having trouble with the current approach as is?
mturcios777 is offline   Reply With Quote

Old   April 23, 2012, 15:16
Default
  #5
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
The initial alpha is right. It seems that the next time step the value of alpha is 0. I just want to keep it as the initial value all the running time.
zxj160 is offline   Reply With Quote

Old   April 25, 2012, 01:23
Default
  #6
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16
ybapat is on a distinguished road
Hello,

You might try this function in fvMatrix.H which sets values in given cells.

//- Set solution in given cells to the specified values
template<template<class> class ListType>
void setValuesFromList
(
const labelUList& cells,
const ListType<Type>& values
);
ybapat is offline   Reply With Quote

Old   April 25, 2012, 12:52
Default
  #7
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
Quote:
Originally Posted by ybapat View Post
Hello,

You might try this function in fvMatrix.H which sets values in given cells.

//- Set solution in given cells to the specified values
template<template<class> class ListType>
void setValuesFromList
(
const labelUList& cells,
const ListType<Type>& values
);
Hi,

Many thanks. Could you tell me more about how to use the function in the fvMatrix.H?
zxj160 is offline   Reply With Quote

Old   April 26, 2012, 00:56
Default
  #8
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16
ybapat is on a distinguished road
Hi,

I think it takes list of cells in which you want to set values and list of values in those cells.
So you have to create list of cells in which you want to set value of alpha.
You have to call this function before solve function for matrix is called.

Regards,
-Yogesh
ybapat is offline   Reply With Quote

Old   April 26, 2012, 14:10
Default
  #9
Senior Member
 
Jian Zhong
Join Date: Feb 2012
Location: Birmingham
Posts: 109
Rep Power: 14
zxj160 is on a distinguished road
Hi Yogesh,

Thanks. I have solved the problem by changing the definition of alpha in the creatalpha.H file similar to 'p'.

Cheers,
Jian
zxj160 is offline   Reply With Quote

Reply

Tags
solvers, uniform constant


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
Free jet simulation msarkar OpenFOAM Running, Solving & CFD 39 May 11, 2021 14:21
chtMultiRegionSimpleFoam javad814 OpenFOAM 1 September 26, 2011 14:30
Need help with boundary conditions: open to atmosphere Wolle OpenFOAM 2 April 11, 2011 08:32
rhoSimpleFoam claco OpenFOAM 7 April 20, 2010 05:32
RasInterFoam STRANGE RESULTS AT BOUNDARY kumar2 OpenFOAM Running, Solving & CFD 8 March 24, 2008 19:38


All times are GMT -4. The time now is 21:17.