|
[Sponsors] |
changing a volScalarField to a dimensionedScalar |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 24, 2011, 16:38 |
changing a volScalarField to a dimensionedScalar
|
#1 |
Member
Walter Schostak
Join Date: May 2011
Posts: 35
Rep Power: 15 |
Hello Foamers,
I've been working on creating a union between interFoam and mhdFoam. Today I made some major progress on getting all the variables aligned but i ran into a bit of a problem. interFoam treats mu and nu as volScalarFields but in order to do the DB and DBU parts of MHD they have to be scalars. Any thoughts on switching back and forth? interFoam calculates nu and mu in the file twoPhaseMixture.H and it calculates them to be scalars. I'm using predefined functions to read them into CreateFields.H Read in of mu and nu: const volScalarField& mu = twoPhaseProperties.mu(); const volScalarField& nu = twoPhaseProperties.nu(); DB and DBU code: dimensionedScalar DB = 1.0/(mu*sigma); DB.name() = "DB"; dimensionedScalar DBU = 1.0/(2.0*(mu ^ rho)); DBU.name() = "DBU"; Any help or pointers are greatly appreciated |
|
May 24, 2011, 23:42 |
|
#2 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
How do you want to represent an entire field of values with a single value? It's entirely up to you. You could take the average... I'd probably do that. Or take a reference point.
Average is: Code:
dimensionedScalar dsMu ( "mu", fieldMu.dimensions(), fieldMu.average() ); |
|
May 25, 2011, 17:13 |
|
#3 |
Member
Walter Schostak
Join Date: May 2011
Posts: 35
Rep Power: 15 |
marupio~
that worked well, I now have a value that appears to be the correct average. I've been coming across some problems getting the correct dimensions and I was wondering if there was a way to reset dimensions. I've tried resetting them using setDimensions but then it starts to get snippy. Thanks in advance, Walter |
|
May 25, 2011, 17:55 |
|
#4 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
To force the dimensions of a dimensionedScalar to change, use:
Code:
// dsNu is a dimensionedScalar dsNu.dimensions().reset(newDimensions); //newDimensions is (of course) a dimensionSet. |
|
May 26, 2011, 12:22 |
|
#5 |
Member
Walter Schostak
Join Date: May 2011
Posts: 35
Rep Power: 15 |
thanks, it worked like a charm!
|
|
May 6, 2015, 11:20 |
|
#6 |
Member
Sandra
Join Date: Oct 2014
Posts: 58
Rep Power: 12 |
Dear OpenFOAMers!
Whatif I want to use the integrated value of the volScalarField instead of the average? Best, Sandra |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
if-loop, volScalarField comparison | volker | OpenFOAM | 7 | March 6, 2020 21:03 |
Problems with creating a volScalarField | georlade | OpenFOAM Programming & Development | 4 | December 4, 2016 13:31 |
Confused about how OF handles operation between volScalarField and dimensionedScalar | Edy | OpenFOAM | 3 | September 30, 2010 11:07 |
scalar + volScalarField | akidess | OpenFOAM Programming & Development | 0 | September 3, 2010 12:11 |
Changing contact line | tfe | FLOW-3D | 3 | December 8, 2009 03:59 |