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

Adding pressure-dependent heat source

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 2, 2021, 23:27
Default
  #21
Member
 
Jonathan Wells
Join Date: Oct 2020
Location: Indiana
Posts: 44
Rep Power: 6
jdw135 is on a distinguished road
Quote:
Originally Posted by HPE View Post
Let's see what we can do during the next week. (At least something for you to progress further rather than a complete solution.)
I've now done quite a bit more reading and I think I can do what I need with a scalarCodedSource. My only problem is that I'm not sure how to implement it, and if my code is doing what I want it to do.

First, do I make a file called "fvOptions" in the /system folder, or do I add this code to the controlDict file in the functions section? Looking at the OpenFOAM API here

https://www.openfoam.com/documentati...e.html#details

it says to put it in the controlDict file. When I do this, the case runs as normal, but there is no difference in the output. I am wondering if there is a problem with my code that is causing an issue. Here is my code:

Code:
energySource
    {
        type            scalarCodedSource;

        active          yes;

        scalarCodedSourceCoeffs
        {
            selectionMode   all;
            fieldNames      (h);
            name            sourceTime;

            codeInclude
            #{
            #};

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

            codeAddSup
            #{
                const Time& time = mesh().time();
                const volScalarField& rhoS = mesh_.lookupObject<volScalarField>("rho");
                const volVectorField& uS = mesh_.lookupObject<volVectorField>("U");
                const volScalarField& pS = mesh_.lookupObject<volScalarField>("p");
                const vectorField& C = mesh_.C();
	        const scalarField& V = mesh_.V();
                scalarField& SoS = sqrt(1.4*(pS/rhoS));
                scalarField& mach = uS/SoS;
                scalarField& qq = -(pS*(1-(mach*mach))1005)/(1.4*(mach*mach)*287.058);
                scalarField& heSource = eqn.source();
                heSource += fvc::ddt(qq);
            #};

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

            // Dummy entry. Make dependent on above to trigger recompilation
            code
            #{
                $codeInclude
                $codeCorrect
                $codeAddSup
                $codeSetValue
            #};
        }
        sourceTimeCoeffs
        {
            // Dummy entry
        }
    }
I tried making an "fvOptions" file, but I kept getting an error about "name" not being found. Can someone please help with this? There isn't a lot of documentation and I'm pulling my hair out here.
jdw135 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
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 36 July 16, 2024 04:52
[OpenFOAM.com] swak4foam compiling issues on a cluster saj216 OpenFOAM Installation 5 January 17, 2023 17:05
Periodic flow using Cyclic - comparison with Fluent nusivares OpenFOAM Running, Solving & CFD 30 December 12, 2017 06:35
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28


All times are GMT -4. The time now is 13:50.