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

How to use fvOption to define a constant source term?

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By fabrice
  • 3 Post By student666
  • 1 Post By fidu

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 30, 2017, 11:50
Default How to use fvOption to define a constant source term?
  #1
New Member
 
fabrice
Join Date: Apr 2016
Posts: 13
Rep Power: 10
fabrice is on a distinguished road
Hi Foamers,
I am trying to define a constant source term with the solver pimpleFoam and I use channel395 case to test.
I modified the solver of pimpleFoam and add concentration equation to it:
fvScalarMatrix CEqn
(
fvm::ddt(C)+fvm::div(phi,C)+ fvm::laplacian(turbulence->nu()/Sc,C)
);
CEqn.solve();
then I want to define a constant source for concentration equation in certain area. How can I do this?
1,I try to use setFields but it only works on initial field
2,I found it can set in fvOption files
momentumSource
{
type meanVelocityForce;
active yes;

meanVelocityForceCoeffs
{
selectionMode all;

fields (U);
Ubar (0.1335 0 0);
relaxation 1.0;
}
}

In my case, I think openFoam dose not have concentration equation, what should I do, can you please give me some suggestions?
ibitscholar likes this.
fabrice is offline   Reply With Quote

Old   November 30, 2017, 16:16
Default
  #2
Member
 
Anders Utnes
Join Date: May 2017
Location: Norway
Posts: 34
Rep Power: 8
Alasir is on a distinguished road
The meanVelocityForce in fvOptions seem to be quite videly used for these kinds of things. It will be applied for all timesteps.

Do you get any errors by simply trying to run it?
Alasir is offline   Reply With Quote

Old   November 30, 2017, 23:20
Default
  #3
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 16
student666 is on a distinguished road
Hi,

I successfully applied this source term for velocity field, maybe you can use as well.
Code:
velocitySource
{
    type            vectorFixedValueConstraint;
    active          true;


    vectorFixedValueConstraintCoeffs
    {

        selectionMode   cellZone;
        cellZone         heater;
        volumeMode absolute;
        fieldValues
        {
            U           (0 1 0);
        }
    }
}
you can have a quite complete overview of fvOptions at
http://www.geocities.jp/penguinitis2...fvOptions.html

(just use google translate)

Regards
Kummi, Ramzy1990 and hhu_lulu like this.
student666 is offline   Reply With Quote

Old   December 1, 2017, 08:06
Default
  #4
Senior Member
 
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 11
RobertHB is on a distinguished road
Great link! Thank you sooo much!
RobertHB is offline   Reply With Quote

Old   December 1, 2017, 09:22
Default
  #5
New Member
 
fabrice
Join Date: Apr 2016
Posts: 13
Rep Power: 10
fabrice is on a distinguished road
Quote:
Originally Posted by Alasir View Post
The meanVelocityForce in fvOptions seem to be quite videly used for these kinds of things. It will be applied for all timesteps.

Do you get any errors by simply trying to run it?
Hi Alasir,
Sorry for my bad explanation, I mean people can use this method to define a source in momentum equation but in my case how can I add a constant source to concentration equation.
fabrice is offline   Reply With Quote

Old   December 1, 2017, 09:33
Default
  #6
New Member
 
fabrice
Join Date: Apr 2016
Posts: 13
Rep Power: 10
fabrice is on a distinguished road
Quote:
Originally Posted by student666 View Post
Hi,

I successfully applied this source term for velocity field, maybe you can use as well.
Code:
velocitySource
{
    type            vectorFixedValueConstraint;
    active          true;


    vectorFixedValueConstraintCoeffs
    {

        selectionMode   cellZone;
        cellZone         heater;
        volumeMode absolute;
        fieldValues
        {
            U           (0 1 0);
        }
    }
}
you can have a quite complete overview of fvOptions at
http://www.geocities.jp/penguinitis2...fvOptions.html

(just use google translate)

Regards
Thanks a lot for your link I will read it. By the way, in my case I add concentration equation myself as far as I know openfoam only have utility for
momentum or energy source. Should I define it myself in solver every time step?
fabrice is offline   Reply With Quote

Old   December 2, 2017, 02:29
Default
  #7
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 16
student666 is on a distinguished road
Hi,

sorry, I thought you needed a velocity field source term.
Are you meaning you have to add a constant scalar source for a species?

If that's the case,
https://www.researchgate.net/publica...ers%27_version

has some more tutorials.

If you give more informations about your needs and what you're doing, others on this forum could be of much more help.

Regards
student666 is offline   Reply With Quote

Old   December 2, 2017, 06:49
Default
  #8
New Member
 
fabrice
Join Date: Apr 2016
Posts: 13
Rep Power: 10
fabrice is on a distinguished road
Quote:
Originally Posted by student666 View Post
Hi,

sorry, I thought you needed a velocity field source term.
Are you meaning you have to add a constant scalar source for a species?

If that's the case,
https://www.researchgate.net/publica...ers%27_version

has some more tutorials.

If you give more informations about your needs and what you're doing, others on this forum could be of much more help.

Regards
M.C
Thank you for help. What I am doing now is add convection diffusion equation to the solver 'pimpleFoam'. I want to simulate a constant pollutant source dispersion, for instance, in a channel. I do not know what's the proper way to define the source in some certain of the area.
fabrice is offline   Reply With Quote

Old   November 5, 2020, 13:34
Default Source therm for TKE and TDR for a porous material
  #9
New Member
 
David
Join Date: Oct 2020
Posts: 21
Rep Power: 5
fidu is on a distinguished road
Hi,
I would like to implement some additional source code for my porous media. I have already applied the Darcy-Frochheimer source term with fvOptions and explicitpourouszone for the momentum therm. Now I would like to implement the turbulent kinetic energy (TKE) and the turbulent dissipation rate (TDR) source term of my porous material. Both terms are dependent on the magnitude of the flow, epsilon, k and some constants. Could you recommend me a strategy how to implement this or are there source terms which I could easily modify?

My source terms are:

s_{TKE} = \rho * c_d a (\beta_p|\overline{u}|^3 - \beta_d |\overline{u}|k)
s_{TDR} = \rho c_d a (\beta_p C_4\epsilon |\overline{u}|^3 \frac{\epsilon}{k} - \beta_d C_5\epsilon |\overline{u}\epsilon))


Sorry if this is stupid question but I quite new to all of this and would greatly appreciate all recommendation or hints

Best
fidu
ali moeni likes this.
fidu is offline   Reply With Quote

Old   June 17, 2023, 13:02
Default
  #10
New Member
 
Join Date: Oct 2021
Posts: 5
Rep Power: 4
ali moeni is on a distinguished road
Quote:
Originally Posted by fidu View Post
Hi,
I would like to implement some additional source code for my porous media. I have already applied the Darcy-Frochheimer source term with fvOptions and explicitpourouszone for the momentum therm. Now I would like to implement the turbulent kinetic energy (TKE) and the turbulent dissipation rate (TDR) source term of my porous material. Both terms are dependent on the magnitude of the flow, epsilon, k and some constants. Could you recommend me a strategy how to implement this or are there source terms which I could easily modify?

My source terms are:

s_{TKE} = \rho * c_d a (\beta_p|\overline{u}|^3 - \beta_d |\overline{u}|k)
s_{TDR} = \rho c_d a (\beta_p C_4\epsilon |\overline{u}|^3 \frac{\epsilon}{k} - \beta_d C_5\epsilon |\overline{u}\epsilon))


Sorry if this is stupid question but I quite new to all of this and would greatly appreciate all recommendation or hints

Best
fidu
Hi there, did you find any solution?
ali moeni is offline   Reply With Quote

Old   November 3, 2023, 06:00
Default
  #11
Member
 
Marķa Rosales
Join Date: Mar 2023
Location: Spain
Posts: 35
Rep Power: 3
MMRC is on a distinguished road
Hello,

For canopy sources/sinks you can adapt a new fvOption from

https://www.openfoam.com/documentati...urbSource.html and from https://www.openfoam.com/documentati...urbSource.html





Quote:
Originally Posted by ali moeni View Post
Hi there, did you find any solution?
MMRC is offline   Reply With Quote

Old   November 12, 2023, 22:55
Default
  #12
New Member
 
Join Date: Nov 2023
Posts: 1
Rep Power: 0
veronicagillis is on a distinguished road
Quote:
Originally Posted by MMRC View Post
You can indeed use fvOptions to add a constant source term to the concentration equation. In your case, you would create an fvOptions file for the concentration equation. Here is an example:

plaintext
Copy code
dimensions [0 0 -2 0 0 0 0];

inletFractionSource
{
// Specify the regions where the source term should be active
selectionMode all;

// Specify the field to which the source term should be added
fields (C);

// Specify the value of the constant source term
CSource 100; // Adjust the value as needed

// Relaxation factor (if needed)
relaxation 1.0;
}
This fvOptions file adds a constant source term to the concentration equation (C field) in the specified regions.
veronicagillis is offline   Reply With Quote

Reply

Tags
fvoption, source terms, toposetsource


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
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 08:06
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 17:18
Installing OF 1.6 on Mac OS X gschaider OpenFOAM Installation 129 June 19, 2010 09:23
Missing math.h header Travis FLUENT 4 January 15, 2009 11:48
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


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