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

Calculation of a dimensionedScalar in a modified turbulence model

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

Like Tree3Likes
  • 1 Post By raumpolizei
  • 2 Post By raumpolizei

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2019, 00:49
Lightbulb Calculation of a dimensionedScalar in a modified turbulence model
  #1
New Member
 
Rahul
Join Date: Aug 2018
Posts: 6
Rep Power: 4
blue_arrow98 is on a distinguished road
Hey guys, I am actually working on developing a turbulence model for magneto hydrodynamic flow. I need to modify a coefficient (which is dimensionedScalar) used in the model. In the original model, it has a constant number value, but in my case I need it to be a function of ratio of Hartmann number to Reynold's number (Ha/Re), but it should be still a dimensioned Scalar.

Now while defining the ratio, Ha/Re = sigma*(B)^2/(U)^2*rho.

Now here, B is magnetic field and U is Velocity (both of which are volVectorField). How do I perform this operation so that my LHS and RHS become of same type. I tried a lot, but I always end up with "error: no match for operator="

Any suggestions are more than welcome!
blue_arrow98 is offline   Reply With Quote

Old   June 9, 2019, 05:28
Default
  #2
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 4
raumpolizei is on a distinguished road
Hey there,
as you already figured out, you will need an additional field for your dynamic variable (checkout the type volScalarField). Additionally, in order to calculate the HaByRe field with your equation, you will have to be aware of the syntax for different vector/tensor operations in OpenFoam. For example, the inner product between two vectors a and b is a & b. You can find all possible operations in the OF programmers guide p. 22 (google).
Good luck!
RP
blue_arrow98 likes this.
raumpolizei is offline   Reply With Quote

Old   June 9, 2019, 23:11
Default
  #3
New Member
 
Rahul
Join Date: Aug 2018
Posts: 6
Rep Power: 4
blue_arrow98 is on a distinguished road
Hey, Thanks for your reply.

I had read through the various operations before, but I am never able to achieve the desired operation to make sure that the value of the turbulence coefficient remains dimensionedScalar. Could you please elaborate on how I can perform the operation?

Rahul
blue_arrow98 is offline   Reply With Quote

Old   June 10, 2019, 04:39
Default
  #4
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 4
raumpolizei is on a distinguished road
Quote:
Originally Posted by blue_arrow98 View Post
I had read through the various operations before, but I am never able to achieve the desired operation to make sure that the value of the turbulence coefficient remains dimensionedScalar. Could you please elaborate on how I can perform the operation?
dimensionedScalar is an OpenFOAM concept. A dimensionedScalar is a scalar (a single value) with some dimensions. You can't you use a dimensionedScalar for a variable that is changing in space in your computational domain. You need a field (different in each cell, as B and U). This is why you need a volScalarField (checkout the OpenFOAM extended code guide). You could initialize your field like this. (check https://www.openfoam.com/documentati...ensionSet.html for the dimensions).


Code:
 volScalarField HaByRe
 (
     IOobject
     (
         "HaByRe",
         runTime.timeName(),
         mesh,
         IOobject::NO_READ,
         IOobject::AUTO_WRITE // NO_WRITE if no output desired
     ),
     mesh,
     dimensionedScalar("0", dimensionSet(0, 0, 0 , 0, 0, 0, 0), 0.0) // init to zero, dimensions must be set via dimensionSet
);
After initialization, it should be possible to assign something to that field. I think it is also possible to do it directly at construction time. Check the geometricField constructors in order to find the right interface for that (also extended code guide).
Cheers

RP
vivek05 and blue_arrow98 like this.
raumpolizei is offline   Reply With Quote

Old   June 11, 2019, 04:10
Default
  #5
New Member
 
Rahul
Join Date: Aug 2018
Posts: 6
Rep Power: 4
blue_arrow98 is on a distinguished road
Hey, Thanks a lot. I will try this.
blue_arrow98 is offline   Reply With Quote

Old   June 26, 2019, 03:55
Default
  #6
New Member
 
Rahul
Join Date: Aug 2018
Posts: 6
Rep Power: 4
blue_arrow98 is on a distinguished road
Hey guys, I solved this problem in a different, but less complicated way without changing the existing code. The only thing that varies in my problem with Ha/Re value is the closure coefficient used in the turbulent model. So, one can easily change it by editing the turbulenceProperties file in the case directory. This is a very common fact which took me long enough to figure out.

Code:
simulationType  RAS;

RAS
{
RASModel        SpalartAllmaras;

SpalartAllmarasCoeffs
{
Cv1 30;
}

turbulence      on;

printCoeffs     on;

}
Hope it helps someone in the future. Also, yes, the only drawback of this method is that you need to calculate the value of closure coefficient manually and then give it as input, which is okay as long as you have limited simulations to run and don't miss out changing the value of everytime the ratio changes.
blue_arrow98 is offline   Reply With Quote

Reply

Tags
mhd, modified turbulence model, programming, turbulencemodel

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
Use of k-epsilon and k-omega Models Jade M Main CFD Forum 39 March 19, 2020 18:27
Turbulence model choice dave13 CFX 3 December 22, 2015 07:12
What model of turbulence choose to study an external aerodynamics case raffale OpenFOAM 0 August 23, 2012 05:45
question about turbulence model selection and sensitivity karananand Main CFD Forum 1 February 26, 2010 04:41
Turbulence Model and Accuracy of convective flux calculation Lokesh Agrawal Main CFD Forum 1 November 14, 1998 23:24


All times are GMT -4. The time now is 00:01.