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

Using fvOption for adding momentum

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

Like Tree2Likes
  • 1 Post By jherb
  • 1 Post By farzadmech

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2020, 13:18
Default Using fvOption for adding momentum
  #1
Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 79
Rep Power: 3
farzadmech is on a distinguished road
Dear friends
I am using fvOption to add extra momentum in the domain and I use fvOption for this purpose, but It does not work properly. my fvOption is as follow;

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

momentumSource

{

    type            meanVelocityForce;

    active          on;            //on/off switch

    //cellSet       sourceSet;

 

    meanVelocityForceCoeffs

    {

        selectionMode   cellZone;
        cellZone        farzadSulzerr; 

        fields                  (U);

        Ubar        ( 0. -1.0 0.);

        relaxation  1.0;

    }

}

// ************************************************************************* //


Do you know what is my mistake?

I have attached my cellZone, and also my simulation which I expect to make difference but fvOption has no effect.
Attached Images
File Type: jpg sulzz.jpg (75.0 KB, 14 views)
File Type: jpg sulz2.jpg (25.8 KB, 14 views)
File Type: jpg sulz3.jpg (71.5 KB, 17 views)
farzadmech is offline   Reply With Quote

Old   October 6, 2020, 11:32
Default
  #2
Member
 
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 59
Rep Power: 2
Tibo99 is on a distinguished road
I was able to do something similar like so and it was working, hope this help:

Code:
fixU
{
	type			vectorFixedValueConstraint;
	active			true;
	
	selectionMode		cellZone;
	cellZone		firstCellU;	
        volumeMode		absolute;
	
	fieldValues
	{
		U	(1.458308317 0 0);
	}
	
}
Regards,
Tibo99 is offline   Reply With Quote

Old   October 6, 2020, 14:43
Default
  #3
Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 79
Rep Power: 3
farzadmech is on a distinguished road
Dear René Thibault
Thanks for your reply. Could you please tell me that if there is any fvOption(U) in your solver? I mean in Ueqn.C?


Thanks,
Farzad


Quote:
Originally Posted by Tibo99 View Post
I was able to do something similar like so and it was working, hope this help:

Code:
fixU
{
	type			vectorFixedValueConstraint;
	active			true;
	
	selectionMode		cellZone;
	cellZone		firstCellU;	
        volumeMode		absolute;
	
	fieldValues
	{
		U	(1.458308317 0 0);
	}
	
}
Regards,
farzadmech is offline   Reply With Quote

Old   October 6, 2020, 14:57
Default
  #4
Member
 
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 59
Rep Power: 2
Tibo99 is on a distinguished road
What exactly does this code is fixing the component 'x' of 'U' at the first cell (I was setting a cellZone on the entire domain on the first cell from the wall with a topoSetDict file and using 'topoSet' command, like you probably did in a similar fashion way) at a fix value of 1.458..... At every time step, the value is carry on and fixed at this value at the cellZone set already.

By using the type 'vectorFixedValueConstraint', apparently you don't need to use the form 'vectorField& uSource = equ.source()' to apply the fixed value. Perform a test, and you'll see in your writing folder under 'U' file that the value will stay fix, the same, during the whole simulation in your cellZone. To answer your question about 'fvOption(U)' and 'Ueqn.C', that is a good question. The only thing that I can answer is I used the standard k-epsilon solver and didn't modify anything in the solver.

Plus, is it possible to use this same technique with scalar value, like 'k' and 'epsilon' by using the type 'scalarFixedValueConstraint'.

If you want to use an equation, maybe this post could help: vectorCodedSource with V momentum equation.


Regards,
Tibo99 is offline   Reply With Quote

Old   October 6, 2020, 16:14
Default
  #5
New Member
 
Hesam Tofighian
Join Date: Mar 2019
Posts: 11
Rep Power: 3
H.Tofighian is on a distinguished road
Could anyone give me a good reference for fvOption usage in OpenFOAM?
H.Tofighian is offline   Reply With Quote

Old   October 7, 2020, 08:35
Default
  #6
Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 79
Rep Power: 3
farzadmech is on a distinguished road
Dear René Thibault
Thank you very much for your answer. I am using DPMFoam and according to below thread;

How to add a source term for driving the flow in periodic model by DPMFoam?

There is no fvOption in the Ueqn.C(Uceqn.C), and I need to add it to my solver, but I have not tested it yet. According to previous thread, adding fvOption is not enough and I have to do another actions also.




Thanks,
Farzad






Quote:
Originally Posted by Tibo99 View Post
What exactly does this code is fixing the component 'x' of 'U' at the first cell (I was setting a cellZone on the entire domain on the first cell from the wall with a topoSetDict file and using 'topoSet' command, like you probably did in a similar fashion way) at a fix value of 1.458..... At every time step, the value is carry on and fixed at this value at the cellZone set already.

By using the type 'vectorFixedValueConstraint', apparently you don't need to use the form 'vectorField& uSource = equ.source()' to apply the fixed value. Perform a test, and you'll see in your writing folder under 'U' file that the value will stay fix, the same, during the whole simulation in your cellZone. To answer your question about 'fvOption(U)' and 'Ueqn.C', that is a good question. The only thing that I can answer is I used the standard k-epsilon solver and didn't modify anything in the solver.

Plus, is it possible to use this same technique with scalar value, like 'k' and 'epsilon' by using the type 'scalarFixedValueConstraint'.

If you want to use an equation, maybe this post could help: vectorCodedSource with V momentum equation.


Regards,
farzadmech is offline   Reply With Quote

Old   October 7, 2020, 09:03
Default
  #7
Member
 
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 59
Rep Power: 2
Tibo99 is on a distinguished road
I use OpenFoam v1906 and I looked into 'DPMFoam.C' file and there is in fact, no 'fvOptions' framework.

Good luck with your work.

Regards,
Tibo99 is offline   Reply With Quote

Old   October 20, 2020, 09:35
Default
  #8
Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 79
Rep Power: 3
farzadmech is on a distinguished road
Dear René Thibault
Finally I decided to code instead of using fvOption, and I did the coding and I have add externalMomentum to the momentum equation in that specific region like this;


Code:
forAll(mesh.C(),i)
{
	scalar x = mesh.C()[i].component(0);
	scalar y = mesh.C()[i].component(1);
	scalar z = mesh.C()[i].component(2);

	
	if(x>0.096 && x<0.404 && y>0.10 && y<0.20 && z>0.0357 && z<0.0643)
	{
	externalMomentum[i] = (1.0 ,0.0 ,0.0);
    }
	
}
But it gives me below error;

Code:
ExMom.H:10:22: error: no match for ‘operator=’ (operand types are ‘Foam::Vector<double>’ and ‘double’)
  externalMomentum[i] = (1.0 ,0.0 ,0.0);
by the way, externalMomentum is a volVectorField. Do you know why this problem happens?


Thanks,
Farzad

Quote:
Originally Posted by Tibo99 View Post
I use OpenFoam v1906 and I looked into 'DPMFoam.C' file and there is in fact, no 'fvOptions' framework.

Good luck with your work.

Regards,
farzadmech is offline   Reply With Quote

Old   October 20, 2020, 11:26
Default
  #9
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 601
Rep Power: 18
jherb is on a distinguished road
Code:
(1.0 ,0.0 ,0.0)
is not a OpenFOAM vector but some C++ construction boiling down to one double value. Either you assign the three values explicitly to the components of the
Code:
externalMomentum[i]
vector of you first create a vector object.
Code:
vector(1.0, 0.0, 0.0)
see e.g. Issue adding force
Tibo99 likes this.
jherb is offline   Reply With Quote

Old   October 20, 2020, 11:59
Default
  #10
Member
 
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 59
Rep Power: 2
Tibo99 is on a distinguished road
I agree with Joachim.
Tibo99 is offline   Reply With Quote

Old   October 20, 2020, 12:31
Default
  #11
Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 79
Rep Power: 3
farzadmech is on a distinguished road
Thanks, It is solved.


Farzad

Quote:
Originally Posted by jherb View Post
Code:
(1.0 ,0.0 ,0.0)
is not a OpenFOAM vector but some C++ construction boiling down to one double value. Either you assign the three values explicitly to the components of the
Code:
externalMomentum[i]
vector of you first create a vector object.
Code:
vector(1.0, 0.0, 0.0)
see e.g. Issue adding force
Tibo99 likes this.
farzadmech is offline   Reply With Quote

Old   October 20, 2020, 13:55
Default
  #12
Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 79
Rep Power: 3
farzadmech is on a distinguished road
Also please see this thread;

Using fvOption for adding momentum in pimpleFoam(changes in pimpleFoam example)


thanks,
Farzad
farzadmech is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Table bounds warnings at: END OF TIME STEP CFXer CFX 4 July 17, 2020 00:44
Question about adaptive timestepping Guille1811 CFX 25 November 12, 2017 18:38
Simulation of Axial Fan Flow using A Momentum Source Subdomain Liam CFX 28 July 16, 2013 09:24
Spray total droplet momentum calculation help tarnsharma AVL FIRE 0 July 19, 2012 09:17
Derivation of Momentum Equation in Integral Form Demonwolf Main CFD Forum 2 October 29, 2009 20:53


All times are GMT -4. The time now is 03:31.