|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Nicholas Langbein
Join Date: Nov 2024
Posts: 21
Rep Power: 2 ![]() |
Hello guys,
i am new to openfoam, i have a variable volScalarField f_sl which is calculated from strain rate multiplied with some constants and then dimensionedScalar (with dimension length) -- now volScalarField is m/s velocity i want to make this volVectorField with f_sl as Z Component to create fvc::flux() using this volVectorField to use for convection. Please can someone give an idea how to make volScalarField to volVectorField i saw volScalarField to volVectorField but Uvec.internalField().replace(vector::X,avgUx.inter nalField()); dosent work |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Join Date: Sep 2024
Posts: 1
Rep Power: 0 ![]() |
Hi Nicholas,
off the top of my head, you could try iterating over your volVectorField and assigning the component from f_sl directly to each field element, sort of along the lines of: Code:
// Define your vector field volVectorField f; // This loops over each cell of your mesh forAll(f_sl, celli){ //Access the z component of your vector field and assign the cell value of the strain rate f[celli].z() = f_sl[celli]; } // ... Let me know if you figure out a more efficient way of doing this though. cheers |
|
![]() |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 825
Rep Power: 16 ![]() |
Quote:
Code:
vector v0(0,0,1); volVectorField v1 ( IOobject ("v1", mesh().time().name(), mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh(), v0 ); v1 *= f_sl; |
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using createPatch and cyclicAMI in FOAM Extend to create periodicbox | manuc | OpenFOAM Running, Solving & CFD | 1 | April 12, 2022 11:36 |
OpenFoam "Permission denied" and "command not found" problems. | iyidaniel@yahoo.co.uk | OpenFOAM Running, Solving & CFD | 11 | January 2, 2018 06:47 |
using chemkin | JMDag2004 | OpenFOAM Pre-Processing | 2 | March 8, 2016 22:38 |
Can't create VolScalarField based on a Dimensioned Scalar | pupo | OpenFOAM Programming & Development | 3 | November 23, 2014 17:29 |
Actuator disk model | audrich | FLUENT | 0 | September 21, 2009 07:06 |