CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Impose a square function on fvOptions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 21, 2022, 03:27
Default Impose a square function on fvOptions
  #1
New Member
 
Giulia
Join Date: Feb 2022
Posts: 19
Rep Power: 4
letoppina is on a distinguished road
Hello,

I am using OpenFOAM version 6 and chtmuliregionfoam. I am using the following code to impose a sinusoidal heat source on my solid region throughout my fvOptions file:

Code:
energySource
    {
        type            scalarCodedSource;
        active          yes;
        timeStart       0;
        duration        1e6;
        name            sourceTime; 
    selectionMode   all;

    scalarCodedSourceCoeffs
        {
        selectionMode   all; 
                volumeMode      specific;           
        fields          (h);
            codeInclude
            #{
            #};

            codeCorrect
            #{
                Pout<< "**codeCorrect**" << endl;
            #};

            codeAddSup
            #{
                    const Time& time = mesh().time();
                    const scalarField& V = mesh_.V();
                    const vectorField& C = mesh_.C();
                    scalarField& heSource = eqn.source();

            heSource += 2.729e6*sin(2*3.14*0.1*time.value())*V;  

                Pout << "***codeAddSup***" << endl;
            #};

            codeSetValue
            #{
                Pout<< "**codeSetValue**" << endl;
            #};

            // Dummy entry. Make dependent on above to trigger recompilation
               code
            #{
                    $codeInclude
                    $codeCorrect
                    $codeAddSup
                    $codeSetValue
            #};
        }
Is it possible to impose a square function instead of a sinusoidal one? Or impose a table of values?

Thank you in advance!!
letoppina is offline   Reply With Quote

Reply

Tags
chtmultiregionfoam, fvoptions, heat source, sinusoidal, square wave


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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 11:04
[swak4Foam] installation problem with version 0.2.3 Claudio87 OpenFOAM Community Contributions 9 May 8, 2013 10:20
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 04:37
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 06:59
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


All times are GMT -4. The time now is 23:44.