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

Set values of a volVectorField to zero

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By GustavGans

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   February 14, 2018, 06:26
Default Set values of a volVectorField to zero
  #1
New Member
 
Join Date: Jan 2018
Posts: 5
Rep Power: 8
GustavGans is on a distinguished road
Hey there,

maybe you can help me with the following problem I'm currently dealing with:

In my solver, I defined a volScalarField border which only contains the values 0 and 1.
Now I would like to set the values of a volVectorField U to zero, but only in the cells where the value of border is 1.

So far, I'm doing this with a forAll-loop, as follows:

Code:
forAll(U,i)
{
    if(border[i] == 1)
    {
        U[i].component(0) = 0;
        U[i].component(1) = 0;
        U[i].component(2) = 0;
    }
}
but since this is an expensive operation, I would like to avoid this. Instead, I would like to use a Matrix-operation, something like (This is only Pseudo-Code, just to show my plan)

Code:
if(border == 1)
{
    U = 0;
}
Any ideas?
GustavGans is offline   Reply With Quote

 


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
correction of Grub after installing Windows XP and 8 immortality Lounge 20 January 5, 2014 17:41
Instalation on ubuntu 710 basilwatson OpenFOAM Installation 17 March 16, 2012 20:16
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 13:43
Set nonuniform boundary values nikwin OpenFOAM Running, Solving & CFD 1 November 30, 2008 07:12
Help with GNUPlot Renato. Main CFD Forum 6 June 6, 2007 19:51


All times are GMT -4. The time now is 09:20.