# Creating a symmTensorField from a scalarField

 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 29, 2011, 11:51 Creating a symmTensorField from a scalarField #1 New Member   Bill Join Date: Jun 2011 Location: UK Posts: 14 Rep Power: 7 Greetings, I'm implementing a boundary condition for a symmTensor variable. I calculate a scalarField, and then want to apply it to the diagonal components of the symmTensorField. The fields are turbulent intensity and reynolds stress, though that really isn't important. The relevant (updateCoeffs) part of the code is as follows... Code: ```if (updated()) return; // boundary velocity const fvPatchVectorField& Up = patch().lookupPatchField(UName_); // "value" is one third of the turbulent intensity scalarField value = 0.5*sqr(intensity_)*magSqr(Up); // "stress" is a symmetric tensor field with diagonal elements equal to "value" symmTensorField stress; // I don't know how to set the values in the tensor /* * / value 0.0 0.0 \ * stress = | 0.0 value 0.0 | * \ 0.0 0.0 value / */ operator==(stress); fixedValueFvPatchSymmTensorField::updateCoeffs();``` As you can see, it is transferring the scalarField values to the symmTensorField which I can't work out how to do. There are no existing derived tensor boundary conditions to copy off, so I'm stuck for ideas. If anyone could help, I'd be eternally grateful. Many thanks, and apologies for reposting this. No-one replied to the last post I made, and I've had some time to re-formulate the question, hopefully a little more clearly.

 September 29, 2011, 14:11 #2 Senior Member   Bernhard Join Date: Sep 2009 Location: Delft Posts: 790 Rep Power: 14 Did you already try something like this: Code: `symmTensorField stress(value,0,0,value,0,value);` I am not sure if it works like this, but otherwise you may want to try: Code: ```symmTensor I(1,0,0,1,0,1); symmTensorField stress=value*I;``` However, for both I am not sure if it works, but it may give you some directions, good luck! Tushar@cfd likes this.

 September 30, 2011, 04:13 #3 New Member   Bill Join Date: Jun 2011 Location: UK Posts: 14 Rep Power: 7 The second of those works. Thank you very much.

 Tags boundary, condition, rstm, scalar, tensor

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Joscha OpenFOAM Native Meshers: blockMesh 27 November 3, 2015 12:27 simvun OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 48 May 14, 2012 05:20 Tarak OpenFOAM 6 September 9, 2011 17:51 Emmanuel Resch CD-adapco 1 July 30, 2007 03:02 mer Main CFD Forum 2 November 12, 2005 09:50

All times are GMT -4. The time now is 18:46.