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

Specify value of surfaceVectorField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 28, 2021, 08:04
Default Specify value of surfaceVectorField
  #1
New Member
 
chen yu Huang
Join Date: Nov 2019
Posts: 18
Rep Power: 6
chenu is on a distinguished road
Hello,
I have a problem when I specify surfaceVectorField.
I will compute flow velocity of each cell face by my own program instead of using fvc::interpolation(U). So I declare a surfaceVectorField called Uf in the createFields.H, just like velocity:

surfaceVectorField Uf
(
IOobject
(
"Uf",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENTS,
IOobject::NO_WRITE
),
mesh
);


In each time step I will assign Uf, for example
Uf[faceID].x()=x velocity I computed ,which is also applied for y and z

But while executing the program, I have this error:
free(): invalid pointer
Aborted (core dumped)


If I comment this line, then there be no problem. It looks like if I specify Uf directly, the program will free Uf twice.

My questions are:
1. How do I assign surfaceVectorField by value and
2. why Uf will be free twice? I have earlier did the same to velocity (volVectorField) but there is no problem.

I will appreciate for any advice. Thank you
chenu is offline   Reply With Quote

Old   January 31, 2021, 04:20
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
https://www.openfoam.com/documentati...8H_source.html

Maybe the way the face flux phi is created helps
mAlletto is offline   Reply With Quote

Old   February 4, 2021, 06:59
Default
  #3
New Member
 
chen yu Huang
Join Date: Nov 2019
Posts: 18
Rep Power: 6
chenu is on a distinguished road
Hello, mAlletto,
Thank you for your answer. I did the same way to create my variable.
I have found the reason due to this error
Quote:
Originally Posted by mAlletto View Post
https://www.openfoam.com/documentati...8H_source.html

Maybe the way the face flux phi is created helps
chenu is offline   Reply With Quote

Reply


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
How can multiple a volScalarField with a surfaceVectorField ndtrong OpenFOAM Programming & Development 2 December 12, 2019 19:48
Syncing surfaceVectorField data across processors D.R. OpenFOAM Running, Solving & CFD 0 November 2, 2016 09:05
SurfaceVectorField not recognized? Verse OpenFOAM Programming & Development 1 September 18, 2016 08:57
surfaceVectorField liuke870915 OpenFOAM Programming & Development 6 April 17, 2013 20:07
surfaceVectorField lulo OpenFOAM 0 August 15, 2011 08:17


All times are GMT -4. The time now is 00:58.