|
[Sponsors] |
March 23, 2011, 13:12 |
magnitude of a volVectorField !!?
|
#1 | |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 17 |
hi foamers,
I have a volVectorField Wrel, and a volScalarField gammadot (of same dimensions) I need to get the volScalarField rhok, where rhok= (2*magnitude(Wrel) ) / (gammadot+magnitude(Wrel)) so i tried the following: volScalarField rhok=2*mag(Wrel)/(gammadot+mag(Wrel)); but it didn't work !!!! it compiles well, but when i run it it gives this error: Quote:
thanks T.D. |
||
March 23, 2011, 14:32 |
|
#2 |
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19 |
I think you're going to end up with a list of values from mag(Wrel) (1 value for each point in your mesh), so you'll have to do a forAll loop to capture that:
Code:
//define rhok as a volScalarField first forAll(rhok, i) { rhok[i]=2*mag(Wrel[i])/(gammadot+mag(Wrel[i])); } |
|
March 24, 2011, 03:26 |
|
#3 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
Are you sure gammadot+mag(Wrel) is never zero?
|
|
March 24, 2011, 04:22 |
|
#4 | |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 17 |
hi guys,
thanks benk and akidess, i tried what you said (benk you forgot "[i]" for gammadot ) finally it was a division by zero error, but i didn't pay attention, and in compiler it says 'uninterpreted error'. Any way here it is Quote:
Best Regards, T.D. |
||
March 24, 2011, 04:30 |
|
#5 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
try this
dimensionedScalar WSmall("WSmall", Wrel.dimension(), 1.0e-15); volScalarField rhok=2*mag(Wrel)/max(WSmall, gammadot+mag(Wrel))); |
|
March 24, 2011, 04:54 |
|
#6 |
Member
Sabin Ceuca
Join Date: Mar 2010
Location: Munich
Posts: 42
Rep Power: 16 |
Hi,
I would try this out: forAll(mesh.cells(), celli) { rhok[celli]=2*mag(Wrel[celli])/(gammadot[celli]+mag(Wrel[celli])); } I was wondering why you don't user gammadot[celli], but gammadot? Regards, |
|
March 24, 2011, 05:14 |
|
#7 |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 17 |
hi, sabin.ceuca
this what i have done exactly as you mensioned: forAll(mesh.cells(), celli) { rhok[celli]=2*mag(Wrel[celli])/(gammadot[celli]+mag(Wrel[celli])+1e-15); } it worked, thanks |
|
July 17, 2016, 23:35 |
|
#8 |
New Member
Fidel Vallejo
Join Date: Dec 2015
Location: Santiago
Posts: 7
Rep Power: 10 |
Please, tell me how define a "volVectorField".
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Initialize a uniform 0 volVectorField | Schag | OpenFOAM | 4 | July 24, 2024 03:18 |
Stresseq vs stress magnitude | watashiwa | OpenFOAM | 1 | October 14, 2010 13:02 |
strain rate magnitude | ahmadbakri | STAR-CCM+ | 1 | June 3, 2010 14:03 |
formula for velocity magnitude | Hai Duc | FLUENT | 0 | January 9, 2008 08:39 |
To get the magnitude of volVectorField | susana | OpenFOAM Pre-Processing | 5 | November 16, 2006 07:53 |