CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Creating a symmTensorField from a scalarField

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

Like Tree2Likes
  • 1 Post By Bernhard
  • 1 Post By maninthemail

Reply
 
LinkBack Thread Tools Display Modes
Old   September 29, 2011, 12:51
Post Creating a symmTensorField from a scalarField
  #1
New Member
 
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 9
maninthemail is on a distinguished road
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<volVectorField, vector>(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.
maninthemail is offline   Reply With Quote

Old   September 29, 2011, 15:11
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 16
Bernhard is on a distinguished road
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.
Bernhard is offline   Reply With Quote

Old   September 30, 2011, 05:13
Default
  #3
New Member
 
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 9
maninthemail is on a distinguished road
The second of those works. Thank you very much.
maninthemail is offline   Reply With Quote

Old   October 17, 2018, 19:19
Default questions
  #4
New Member
 
meihuazhang
Join Date: Oct 2018
Posts: 6
Rep Power: 2
meihua is on a distinguished road
Quote:
Originally Posted by maninthemail View Post
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<volVectorField, vector>(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.

Hi Bill,
I'm implementing a boundary condition for a symmTensor variable now, but I do not know how to start. Could you share your solver or case?

Thanks in advance.

Meihua
meihua is offline   Reply With Quote

Old   October 18, 2018, 05:11
Default
  #5
New Member
 
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 9
maninthemail is on a distinguished road
This post is 7 years old. I don't have the files any more.



If you want to write a boundary condition for a symmetric tensor, you can run the following to get you started...


Code:
foamNewBC -f -symmTensor myBoundaryCondition
meihua likes this.
maninthemail is offline   Reply With Quote

Old   October 19, 2018, 01:06
Default
  #6
New Member
 
meihuazhang
Join Date: Oct 2018
Posts: 6
Rep Power: 2
meihua is on a distinguished road
Quote:
Originally Posted by maninthemail View Post
This post is 7 years old. I don't have the files any more.



If you want to write a boundary condition for a symmetric tensor, you can run the following to get you started...


Code:
foamNewBC -f -symmTensor myBoundaryCondition

Thank you, Bill.
meihua is offline   Reply With Quote

Old   October 30, 2018, 00:21
Default
  #7
New Member
 
meihuazhang
Join Date: Oct 2018
Posts: 6
Rep Power: 2
meihua is on a distinguished road
Quote:
Originally Posted by maninthemail View Post
This post is 7 years old. I don't have the files any more.



If you want to write a boundary condition for a symmetric tensor, you can run the following to get you started...


Code:
foamNewBC -f -symmTensor myBoundaryCondition
Hi Bill,

Another question about tensor boundary condition. If I set a tensor on the boundary, how can it exist? I mean it seems that a tensor cannot exist on a surface, but in OpenFoam, the boundaries are surfaces. Maybe my understanding is wrong. Thanks in advance!
meihua is offline   Reply With Quote

Old   Yesterday, 04:37
Default
  #8
New Member
 
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 9
maninthemail is on a distinguished road
The geometry that the field is associated with does not impose any limit on the data type. The field in question is just a list of symmTensors, one per patch face. How they relate to the patch geometry (face normals, areas, etc...) depends on your implementation.
maninthemail is offline   Reply With Quote

Reply

Tags
boundary, condition, rstm, scalar, tensor

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent3DMeshToFoam simvun OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 49 July 2, 2018 23:50
Problems in creating a wedge type mesh Joscha OpenFOAM Native Meshers: blockMesh 27 November 3, 2015 12:27
Problem in running ICEM grid in Openfoam Tarak OpenFOAM 6 September 9, 2011 18:51
Problems with Meshing: Collapsed Cells Emmanuel Resch Siemens 1 July 30, 2007 04:02
Gerris software installation mer Main CFD Forum 2 November 12, 2005 09:50


All times are GMT -4. The time now is 22:24.