|
[Sponsors] |
January 16, 2015, 02:21 |
How to access identity matrix in OF?
|
#1 |
Senior Member
|
Dear Foamers,
I wish to use identity matrix "I" for a Tensor field. I am using the following line for writing the identity matrix. Code:
volTensorField Ei = I ; Code:
testFoam.C: In function ‘int main(int, char**)’: testFoam.C:71:22: error: conversion from ‘const sphericalTensor {aka const Foam::SphericalTensor<double>}’ to non-scalar type ‘Foam::volTensorField {aka Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>}’ requested Thanks in Advance! |
|
January 16, 2015, 05:46 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Try something like
Code:
volTensorField Ei = tensor::one; |
|
January 16, 2015, 06:02 |
|
#3 |
Senior Member
|
Hi,
Either use correct constructor (something like this): Code:
volTensorField Ei ( IOobject ( "Ei", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, <dimensions>, <BC type>, I ); |
|
March 7, 2015, 00:43 |
|
#5 |
New Member
Amir
Join Date: Jul 2011
Location: Shiraz
Posts: 15
Rep Power: 15 |
Hi
I've put Code:
volTensorField Ei; Code:
Ei ( IOobject ( "Ei", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, ), Code:
error: expected primary-expression before ‘)’ token |
|
March 7, 2015, 01:49 |
|
#6 | |
Senior Member
|
Quote:
Try these: Code:
volTensorField Ei ( IOobject ( "Ei", runTime_.timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, ); Code:
Ei = tensor::one; - Best Luck! |
||
March 9, 2015, 00:47 |
|
#7 |
New Member
Amir
Join Date: Jul 2011
Location: Shiraz
Posts: 15
Rep Power: 15 |
Dear Tushar
I solved the problem by using tensor Ei(1,0,0,0,1,0,0,0,1); and it worked , wish U the best my friend and thanks a lot for quick answering |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convection Diffusion 1-D Matrix Problem | balrog | Main CFD Forum | 1 | November 3, 2014 14:34 |
more equation in block matrix system | yhaomin2007 | OpenFOAM | 1 | September 6, 2012 09:33 |
Access to arrays of Pressure matrix in CFX | omidiut | CFX | 5 | October 14, 2011 13:05 |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 23:03 |
OpenFOAM version 1.6 details | lakeat | OpenFOAM Running, Solving & CFD | 42 | August 26, 2009 22:47 |