|
[Sponsors] |
Problems compiling with the 'diag' tensor function (diagonal components matrix) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 15, 2010, 10:55 |
Problems compiling with the 'diag' tensor function (diagonal components matrix)
|
#1 |
New Member
Join Date: Jul 2009
Posts: 3
Rep Power: 17 |
Hi everyone
I'm trying to create a strain rate function with only normal components (no shear). In order to do this I have to add the following code to src » transportModels » incompressible » viscosityModels » viscosityModel » viscosityModel.C: Foam::tmp<Foam::volScalarField> Foam::viscosityModel::NormalStrainRate() const { return mag(diag(fvc::grad(U_))); } When I try to compile everything is fine but I get an error with the following description: 'diag' was not decleared in this scope This is strange because I could use any other tensor operation function: symm, dev, skew, etc.. I don't get any error with them!! Does anybody know why 'diag' is not declared? does it need any special heather file included (ie: #include fvCFD.H)? Please could somebody reply this thread, everytime I post a thread in the OpenFOAM forum I never get a reply. A reply would be appreciated Thanks |
|
April 21, 2010, 12:55 |
|
#2 |
New Member
Sebastian W
Join Date: Nov 2009
Location: Germany
Posts: 16
Rep Power: 17 |
I'm facing the same problem here.
Help would be greatly appreciated. naval |
|
April 21, 2010, 15:39 |
|
#3 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 18 |
Hi,
did you try this? return Foam::mag(Foam::diag(fvc::grad(U_))); Sometimes it helps the compiler to find the right function. Regards |
|
April 22, 2010, 01:51 |
help
|
#4 |
Member
mohsen kh
Join Date: Nov 2009
Posts: 41
Rep Power: 16 |
hi everyone
I have a new solver for two-phase modeling. but there is a problem while running any case (dam break for instance). when in ControlDict I put the write interval one second the solution diverge quickly but if I put it .05 second the solution converges. I could not understand how the write interval affects the convergence of the system. please help as soon as possible |
|
April 22, 2010, 02:05 |
help
|
#5 |
Member
mohsen kh
Join Date: Nov 2009
Posts: 41
Rep Power: 16 |
hi everyone
I need to work with asymmetric tensors in OpenFOAM. how can I implement a asymmetric tensor in a new solver in openfoam? the best |
|
April 22, 2010, 07:28 |
|
#6 | ||
New Member
Sebastian W
Join Date: Nov 2009
Location: Germany
Posts: 16
Rep Power: 17 |
Quote:
I tried that one before, but I get this (now even more confusing) error: Quote:
Any ideas what to try next? Cheers, naval |
|||
April 22, 2010, 08:35 |
|
#7 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 18 |
Hi naval,
I know this is not the way such problems should be solved, but I would do it this way: Implement your own magDiag. volTensorField gradU_ = fvc::grad(U_); volScalarField strainRate_ = Foam::sqrt( Foam:ow(gradU_.component(tensor::XX), 2.0) + Foam:ow(gradU_.component(tensor::YY), 2.0) + Foam:ow(gradU_.component(tensor::ZZ), 2.0) ); |
|
April 22, 2010, 09:16 |
|
#8 | |
New Member
Sebastian W
Join Date: Nov 2009
Location: Germany
Posts: 16
Rep Power: 17 |
Unlike danihuso I actually need the resulting vector, not its magnitude.
Nevertheless I will try this approach and write my own diag. Btw, your example doesn't compile, either (although I replaced the smilies ): Quote:
even if only add volTensorField gradU_ = fvc::grad(U_);. I've got the feeling, that I'm missing sth basic, here. Since I'm going to set up a new system on a new machine anyway I will be able to test diag with a freshly compiled OF in a couple of days. Hopefully with a little more luck. Thanks a lot for your help and time, Cheers, naval |
||
April 22, 2010, 09:46 |
|
#9 |
New Member
Sebastian W
Join Date: Nov 2009
Location: Germany
Posts: 16
Rep Power: 17 |
I'm babbling nonsense, here.
Your code compiles, of course. I messed up some of my own code before when I was interrupted by the phone. So a handmade diag will probably work. Cheers, naval |
|
March 4, 2011, 15:39 |
|
#10 |
Member
Hagen Müller
Join Date: Nov 2010
Posts: 34
Rep Power: 16 |
Dear Foamers,
I face the same problem that you discussed above. The diag() operator does not work. I get the same error "‘diag’ was not declared in this scope" Any new insights on that problem? I also tried to wright my own diag(), but got stuck trying to assemble a vectorField from three scalarFields, which I defined as scalarField a = TensorA.component(tensor::XX); scalarField b = TensorA.component(tensor::YY); scalarField c = TensorA.component(tensor::ZZ); vectorField diagTensorA = vector(a, b, c); This does not work. I would greatly appreciate any help on that issue. |
|
January 31, 2012, 10:31 |
diag removed?
|
#11 |
New Member
Michael B Martell Jr
Join Date: Feb 2010
Location: Amherst, MA
Posts: 18
Rep Power: 16 |
It appears as if diag has been removed for some reason. Solvers such as XiFoam have lines which used diag commented out and replaced by other things.
This is despite the fact that the user's guide continues to claim that diag exists. Any comments? Any simple workarounds? |
|
January 31, 2012, 11:23 |
|
#12 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
Use a diagTensor / diagTensorField instead.
|
|
January 31, 2012, 11:45 |
Thanks
|
#13 |
New Member
Michael B Martell Jr
Join Date: Feb 2010
Location: Amherst, MA
Posts: 18
Rep Power: 16 |
Yep. Got that earlier this morning. Thanks Sandeep!
|
|
Tags |
compile, diag, functions, matrix, tensor |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Matrix storage and diagonal coeffients calculation | santiagomarquezd | OpenFOAM Programming & Development | 16 | January 14, 2022 05:48 |
Problems in compiling paraview in Suse 10.3 platform | chiven | OpenFOAM Installation | 3 | December 1, 2009 08:21 |
OpenFOAM version 1.6 details | lakeat | OpenFOAM Running, Solving & CFD | 42 | August 26, 2009 22:47 |
Problems compiling UDFs under SuSE 10.2 | George | FLUENT | 1 | February 21, 2007 09:36 |
Problems on Compiling UDF in FLUENT | Strawberi-KeatKeat | FLUENT | 1 | October 4, 2006 02:50 |