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

fvOptions and Vector/Vectorfield in simpleFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 24, 2017, 10:02
Unhappy fvOptions and Vector/Vectorfield in simpleFoam
  #1
New Member
 
Andreas Müller
Join Date: Feb 2017
Posts: 5
Rep Power: 9
Andreas M. is on a distinguished road
Hi,

i ran into an issue using fvOptions and since I haven't found any solution yet:

I want to use fvOptions in order to add a precalculated sourceterm to my UEqn.

Despite the examples i found yet, fvOptions should contain a vector/vectorfield, which are calculated in advance for the whole interior region.

Examplecode:
Code:
tmp<fvVectorMatrix> UEqn
    (
        fvm::div(phi, U)
      + turbulence->divDevReff(U)
      ==
        fvOptions(U)
    );
where "fvOptions(U)" is a (most likely) different vector for every cell.
Just adding the vector/vectorfield into the equation results into a Foam Fatal Error.

Im glad for every response.

Thanks in advance.


Im sorry for grammatical errors.
Andreas M. is offline   Reply With Quote

Old   February 24, 2017, 11:35
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
Code:
fvVectorMatrix UEqnLHS
(
    fvm::div(phi, U)
 + turbulence->divDevReff(U)
);

IOobject io
(
    "USource",
    U.instance(),
    U.mesh(),
    NO_READ,
    NO_WRITE,
    false
);

DimensionedVectorField USource
(
    io,
    U.mesh(),
    UEqnLHS.dimensions()/dimVolume;
);

forAll(USource, i)
{
    USource[i] = vector(i, 2*i, 3*i);
}

fvVectorMatrix UEqn
(
    UEqnLHS 
 == USource
);
Zeppo 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



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