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

Fluctuating component of a scalar quantity

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 3 Post By elden
  • 2 Post By elden

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 9, 2019, 13:59
Default Fluctuating component of a scalar quantity
  #1
New Member
 
Pietro Tavazzi
Join Date: Aug 2019
Location: Milan, Italy
Posts: 8
Rep Power: 7
elden is on a distinguished road
Hi,
I'm dealing with external aerodynamics problems with dispersion of gaseous substances.
Simulations are carried out considering URANS and a Scale Adaptive approach for the turbulence model (kOmegaSSTSAS). The tracer gas is transported by means of the scalarTransport FO (i.e. as a passive scalar)

I'd like to postprocess not only the Reynolds Stress Tensor by means of the prime2Mean utility but also the turbulent diffusion flux of concentration : <u'*c'>; <v'*c'>; <w'*c'>
Related to the postProcess of these last three quantities I'm facing two problems:

- The first one is mainly conceptual and it's related to the fluctuating part of the velocity field. Since the turbulence model is the kOmegaSSTSAS, should I compute directly the fluctuations of the velocity field? Or should I consider the assumprtion made in the turbulenceIntensity FO (u'=v'=w') accounting for the fluctuating part as uPrime=sqrt(k*2/3)?
- The second is related to the code needed in order to evaluete the turbulence intensity of a scalar (c') and subsequently the turbulent diffusion fluxes (< u_i '*c' >). My intent was to somehow exploit the FO (fieldAverage.C/H and fieldAverageItem) used for prime2Mean computation but I got lost. I can't find the proper way to do that.

Thanks for reading.
Hoping to find some answers
elden is offline   Reply With Quote

Old   September 9, 2019, 12:15
Default possible answer to question number 2
  #2
New Member
 
Pietro Tavazzi
Join Date: Aug 2019
Location: Milan, Italy
Posts: 8
Rep Power: 7
elden is on a distinguished road
Well,
I think I've menaged to do what I needed. Instead of changing fieldAverageTemplates.C with an additional variable (like, let's say, primeField), I tried to evaluate < u' c' >, < v' c' >, and < w' c' > in the following way:
mean value of U and c thanks the fieldAverage FO --> definition of the new variable U' (3 components vector) * c' as (U - UMean)*(c - cMean) --> mean value of this new variable.
I hope this is a valid approach since the fieldAverage code computes the iterative average.
elden is offline   Reply With Quote

Old   January 30, 2020, 05:35
Default
  #3
Member
 
Pedro Ramos
Join Date: Mar 2012
Location: Belgium
Posts: 81
Rep Power: 14
pedroxramos is on a distinguished road
Quote:
Originally Posted by elden View Post
Well,
I think I've menaged to do what I needed. Instead of changing fieldAverageTemplates.C with an additional variable (like, let's say, primeField), I tried to evaluate < u' c' >, < v' c' >, and < w' c' > in the following way:
mean value of U and c thanks the fieldAverage FO --> definition of the new variable U' (3 components vector) * c' as (U - UMean)*(c - cMean) --> mean value of this new variable.
I hope this is a valid approach since the fieldAverage code computes the iterative average.

hi,


would you mind sharing your script for this part?
pedroxramos is offline   Reply With Quote

Old   January 31, 2020, 07:40
Default
  #4
New Member
 
Pietro Tavazzi
Join Date: Aug 2019
Location: Milan, Italy
Posts: 8
Rep Power: 7
elden is on a distinguished road
Quote:
Originally Posted by pedroxramos View Post
hi,


would you mind sharing your script for this part?

This is the code. The C2H4 scalarField is the one being transported within the flow field
Attached Images
File Type: png postProcess.png (78.7 KB, 61 views)
pedroxramos and Hughtong like this.
elden is offline   Reply With Quote

Old   January 31, 2020, 07:46
Default
  #5
Member
 
Pedro Ramos
Join Date: Mar 2012
Location: Belgium
Posts: 81
Rep Power: 14
pedroxramos is on a distinguished road
thanks a lot!
pedroxramos is offline   Reply With Quote

Old   February 21, 2020, 09:05
Default
  #6
Member
 
Pedro Ramos
Join Date: Mar 2012
Location: Belgium
Posts: 81
Rep Power: 14
pedroxramos is on a distinguished road
Quote:
Originally Posted by elden View Post
This is the code. The C2H4 scalarField is the one being transported within the flow field

hi again, are you sure you only need those files? We tried to run it on the pitzDaily (pisoFoam) and it didn't save the new variable...
pedroxramos is offline   Reply With Quote

Old   February 24, 2020, 08:57
Default
  #7
Member
 
Pedro Ramos
Join Date: Mar 2012
Location: Belgium
Posts: 81
Rep Power: 14
pedroxramos is on a distinguished road
Quote:
Originally Posted by elden View Post
This is the code. The C2H4 scalarField is the one being transported within the flow field

is the right side to be put in the createFields.H?
pedroxramos is offline   Reply With Quote

Old   February 27, 2020, 16:38
Default
  #8
New Member
 
Pietro Tavazzi
Join Date: Aug 2019
Location: Milan, Italy
Posts: 8
Rep Power: 7
elden is on a distinguished road
In this thread I was talking about the passive transport of a scalar quantity. One way to tackle this task consists into the use of the scalarTransport FO. This FO looks for a file in the 0 folder named as the field name used (in my case C2H4)
elden is offline   Reply With Quote

Old   February 27, 2020, 16:40
Default
  #9
Member
 
Pedro Ramos
Join Date: Mar 2012
Location: Belgium
Posts: 81
Rep Power: 14
pedroxramos is on a distinguished road
Quote:
Originally Posted by elden View Post
In this thread I was talking about the passive transport of a scalar quantity. One way to tackle this task consists into the use of the scalarTransport FO. This FO looks for a file in the 0 folder named as the field name used (in my case C2H4)
got it now, thanks!
pedroxramos is offline   Reply With Quote

Old   April 9, 2022, 11:13
Default
  #10
New Member
 
Shengjie Lu
Join Date: Sep 2020
Location: Nanjing,China
Posts: 12
Rep Power: 6
hhu_lulu is on a distinguished road
Quote:
Originally Posted by elden View Post
This is the code. The C2H4 scalarField is the one being transported within the flow field
Thank you, Elden. Your script is of great help to me.
In my LES case, the Umean and cMean only makes sense when they are statistically converged. So I set a timeStart for this coded FO. I imposed your code in my simulation, trying to calculate time-averaged <u*c> and <u'*c'>. However, the simulation aborted at the half of the calculation, and the error shows:
Code:
new cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library
Here's part of script calculating <u*c>, the case aborted at runTime ≈ 98s.
Code:
fluctuation_flux1
	{
		type			coded;
		libs			("libutilityFunctionObjects.so");
		enabled			true;
		timeStart		74;
		timeEnd			200;
		writeControl	adjustableRunTime;
		writeInterval	200;
		name			flux1;
		
		codeExecute
		#{
			const volVectorField& U = mesh().lookupObject<volVectorField>("U");		
			const volScalarField& s = mesh().lookupObject<volScalarField>("s");		
			
			obr_.store
			(
				new	volVectorField	
				(
					IOobject
					(
						"flux1",
						obr_.time().timeName(),
						obr_,
						IOobject::NO_READ,
						IOobject::AUTO_WRITE
					),
					U*s
				)
			);
			const volVectorField& flux1 = obr_.lookupObject<volVectorField>("flux1");
		#};
	}
Code:
fieldAverage1
    {
      type            fieldAverage;
      functionObjectLibs ( "libfieldFunctionObjects.so" );
      resetOnRestart true;
      resetOnOutput false;
	  startTime     75; 		
      endTime       200; 		
      writeControl    adjustableRunTime;
      writeInterval   200;
      
	  fields
      (
            flux1
        {
            mean        on;
            prime2Mean  on;
            base        time;	  
        }
      );
    }
I doubt there's something wrong with pointer stack overflow, sorry for my poor programming.
hhu_lulu is offline   Reply With Quote

Reply

Tags
fieldaverageitem, turbulence intensity, uprime


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
OpenFOAM extended 4.0 Error with Multinode Set-up Liweix OpenFOAM Running, Solving & CFD 1 February 18, 2020 01:50
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 05:18
Division by zero exception - loop over scalarField Pat84 OpenFOAM Programming & Development 6 February 18, 2017 06:57
Diverging solution in transonicMRFDyMFoam tsalter OpenFOAM Running, Solving & CFD 30 July 7, 2014 07:20
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 02:47


All times are GMT -4. The time now is 02:27.