Problems compiling with the 'diag' tensor function (diagonal components matrix)
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 |
I'm facing the same problem here.
Help would be greatly appreciated. naval |
Hi,
did you try this? return Foam::mag(Foam::diag(fvc::grad(U_))); Sometimes it helps the compiler to find the right function. Regards |
help
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 |
help
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 |
Quote:
I tried that one before, but I get this (now even more confusing) error: Quote:
Any ideas what to try next? Cheers, naval |
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::pow(gradU_.component(tensor::XX), 2.0) + Foam::pow(gradU_.component(tensor::YY), 2.0) + Foam::pow(gradU_.component(tensor::ZZ), 2.0) ); |
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 |
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 |
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. |
diag removed?
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. :mad: Any comments? Any simple workarounds? |
Use a diagTensor / diagTensorField instead.
|
Thanks
Yep. Got that earlier this morning. Thanks Sandeep!
|
All times are GMT -4. The time now is 07:18. |