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

How to set and read time-dependent source terms

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   September 16, 2012, 13:19
Default How to set and read time-dependent source terms
  #1
New Member
 
Dean Meyer
Join Date: Jul 2012
Posts: 4
Rep Power: 13
DeanM is on a distinguished road
Dear Foamers,

I would like to read a time-dependent source term, which can be defined by a function in a file in the case directory and read from the solver itself.
So far I managed to set the source term using funkySetFields, but only as initial condition. My approach is the following: In createFields.H the field of the mass source is defined as follows:
Code:
       
        volScalarField massSource
        (
        IOobject
        (
            "massSource",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        ),
        mesh
        );
The equation to solve looks like
Code:
    fvScalarMatrix rhoEqn
    (
      fvm::ddt(rho) 
    + some terms
    == massSource
    );
    rhoEqn.solve();
Finally the user should be able to define "massSource" with a mathematical expression as function of time and space in a file in the case directory. I tried to do it with funkySetFields, it works well for time 0, but I need it for all times. Example:
Code:
    massSource
    {
        field massS;
        expression    "sin(pi*time())*(pos().x+pos().y"; //arbitrary function 
        //condition    "...";
    }
In conclusion: How can I define and read time-dependent source terms from the case directory?
Thank you for any ideas.
D.
DeanM 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
How to read field files from the two different time directories fumiya OpenFOAM 1 August 1, 2021 06:58
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 32 June 16, 2021 06:55
How to show the transient case? H.P.LIU Phoenics 7 July 13, 2010 04:31
contribution of convective source in total source? Antony Phoenics 4 July 30, 2008 05:15
How to set environment variables kanishka OpenFOAM Installation 1 September 4, 2005 10:15


All times are GMT -4. The time now is 08:41.