|
[Sponsors] |
Creating a symmTensorField from a scalarField |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 29, 2011, 12:51 |
Creating a symmTensorField from a scalarField
|
#1 |
New Member
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 15 |
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(); 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, 15:11 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
Did you already try something like this:
Code:
symmTensorField stress(value,0,0,value,0,value); Code:
symmTensor I(1,0,0,1,0,1); symmTensorField stress=value*I; |
|
September 30, 2011, 05:13 |
|
#3 |
New Member
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 15 |
The second of those works. Thank you very much.
|
|
October 17, 2018, 19:19 |
questions
|
#4 | |
New Member
meihuazhang
Join Date: Oct 2018
Posts: 8
Rep Power: 8 |
Quote:
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 |
||
October 18, 2018, 05:11 |
|
#5 |
New Member
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 15 |
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 |
|
October 19, 2018, 01:06 |
|
#6 |
New Member
meihuazhang
Join Date: Oct 2018
Posts: 8
Rep Power: 8 |
||
October 30, 2018, 00:21 |
|
#7 | |
New Member
meihuazhang
Join Date: Oct 2018
Posts: 8
Rep Power: 8 |
Quote:
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! |
||
November 15, 2018, 04:37 |
|
#8 |
New Member
Bill
Join Date: Jun 2011
Location: UK
Posts: 16
Rep Power: 15 |
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.
|
|
November 26, 2018, 16:29 |
version of openfoam?
|
#9 |
New Member
|
This command seems not to be in OF-2.3.x.
Is it new ? |
|
November 26, 2018, 16:32 |
|
#10 |
New Member
meihuazhang
Join Date: Oct 2018
Posts: 8
Rep Power: 8 |
||
November 26, 2018, 16:33 |
|
#11 |
New Member
meihuazhang
Join Date: Oct 2018
Posts: 8
Rep Power: 8 |
||
November 26, 2018, 17:03 |
|
#12 |
New Member
|
Not for now. I'm actually working on simple non-newtonian turbulent mixing.
I was targeting the FENE model where there are symmTensor tau. But I dropped that... Programming in OpenFOAM is not evident. At the time I was interested in creating a moving BC for FENE for specific type "symmTensor". |
|
November 26, 2018, 17:18 |
Tensorial BC
|
#13 |
New Member
|
Tensorial BC exists.
Take a look at http://https://github.com/fppimenta/rheoTool/blob/master/of40/tutorials/rheoFoam/Cavity/Oldroyd-BLog/0/tau Where tau (That I mentioned in previous post) is a symmTensor. |
|
April 22, 2023, 07:43 |
|
#14 |
Member
Join Date: Apr 2019
Location: India
Posts: 81
Rep Power: 7 |
Hi Everyone,
Is it possible to use codedFixedValue boundary condition to define boundary value of a symmTensor field ? I am working on rheoTool and I need to set Poiseuille stress profile at the inlet. Code:
inlet { type codedFixedValue; value uniform (0 0 0 0 0 0); name poisStress; code #{ const vectorField& Cf = patch().Cf(); vectorField& field = *this; const scalar q = 1e-06; const scalar h0 = 0.4e-03; const scalar l = 0.4e-03; forAll(Cf, faceI) { const scalar y = Cf[faceI][1]; field[faceI] = symmTensor((1 + 4.50 * ((l*q*y)/(h0*h0*h0)) * ((l*q*y)/(h0*h0*h0))),(-(3*l*q*y)/(2*h0*h0*h0)),0,1,0,0); } #}; } Code:
Using dynamicCode for codedFixedValue poisStress at line 24 in "/home/pavi/OpenFOAM/pavi-9/run/De03/0/tau/boundaryField/inlet" Creating new library in "dynamicCode/poisStress/platforms/linux64GccDPInt32Opt/lib/libpoisStress_abc86e80ab96b5188231ac88cede6087b6e5bd77.so" "/opt/openfoam9/etc/codeTemplates/dynamicCode/codedFixedValueFvPatchFieldTemplate.C" "/home/pavi/OpenFOAM/pavi-9/run/De03/dynamicCode/poisStress/codedFixedValueFvPatchFieldTemplate.C" "/opt/openfoam9/etc/codeTemplates/dynamicCode/codedFixedValueFvPatchFieldTemplate.H" "/home/pavi/OpenFOAM/pavi-9/run/De03/dynamicCode/poisStress/codedFixedValueFvPatchFieldTemplate.H" Invoking "wmake -s libso /home/pavi/OpenFOAM/pavi-9/run/De03/dynamicCode/poisStress" wmake libso /home/pavi/OpenFOAM/pavi-9/run/De03/dynamicCode/poisStress ln: ./lnInclude wmkdep: codedFixedValueFvPatchFieldTemplate.C Ctoo: codedFixedValueFvPatchFieldTemplate.C /home/pavi/OpenFOAM/pavi-9/run/De03/0/tau/boundaryField/inlet: In member function ‘virtual void Foam::poisStressFixedValueFvPatchSymmTensorField::updateCoeffs()’: /home/pavi/OpenFOAM/pavi-9/run/De03/0/tau/boundaryField/inlet:32:25: error: invalid initialization of reference of type ‘Foam::vectorField&’ {aka ‘Foam::Field<Foam::Vector<double> >&’} from expression of type ‘Foam::poisStressFixedValueFvPatchSymmTensorField’ /home/pavi/OpenFOAM/pavi-9/run/De03/0/tau/boundaryField/inlet:42:42: error: no match for ‘operator=’ (operand types are ‘Foam::Vector<double>’ and ‘Foam::symmTensor’ {aka ‘Foam::SymmTensor<double>’}) Thank You. |
|
Tags |
boundary, condition, rstm, scalar, tensor |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commercial meshers] Fluent3DMeshToFoam | simvun | OpenFOAM Meshing & Mesh Conversion | 50 | January 19, 2020 16:33 |
[blockMesh] Problems in creating a wedge type mesh | Joscha | OpenFOAM Meshing & Mesh Conversion | 28 | August 3, 2019 08:59 |
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 |