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

Source term in fvScalarMatrix

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 5, 2019, 15:03
Question Source term in fvScalarMatrix
  #1
Member
 
Vivek
Join Date: Mar 2018
Location: India
Posts: 54
Rep Power: 8
vivek05 is on a distinguished road
Hi Everyone,
I am trying to impose a particular condition for source term in fvScalarMatrix Eqn using if - else condition with the help of forAll loop to initialize in all computational cells. Below I mentioned the condition. Now the problem is after 18th time steps the code got crashed down. Log file also has been attached with this thread.

PHP Code:
const volScalarField turb_nut turbulence->nut(); 
const 
volScalarField turb_k turbulence->k(); 

    
Info << "Source term calculation starting" <<endl;
        
forAll(mesh.cells(),celli)
        {
        if(((
ALPHA[counter][celli])*(1.0-(ALPHA[counter][celli]))) > 0.001)
        {
    
SourceElsa[celli] = ((CTurbElsaSigmaPrime*(turb_k[celli]/(ElsaTinyJap+turb_nut[celli]))*tmpElsaSigma[celli]*(1-(tmpElsaSigma[celli]/(tmpElsaSigmaEquil[celli]+sigmaTiny)))/(runTime.deltaT().value()*CTurbElsaSigmaPrime*(turb_k[celli])/(ElsaTinyJap+turb_nut[celli]))*(1-2*((tmpElsaSigma[celli]/(tmpElsaSigmaEquil[celli]+sigmaTiny))))));
        }
        else
        {
        
SourceElsa[celli] = SourceZero[celli];    
        }
        } 
Could someone figure out where did I make a mistake here??
Attached Files
File Type: docx log.docx (94.8 KB, 6 views)
vivek05 is offline   Reply With Quote

Old   June 6, 2019, 06:55
Default
  #2
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15
agustinvo is on a distinguished road
Hi


coud you post the equations you want to implement? Did you check in the fvOptions if there is something you could reuse, or in other solvers?
agustinvo is offline   Reply With Quote

Old   June 6, 2019, 08:30
Post
  #3
Member
 
Vivek
Join Date: Mar 2018
Location: India
Posts: 54
Rep Power: 8
vivek05 is on a distinguished road
Quote:
Originally Posted by agustinvo View Post
Hi


coud you post the equations you want to implement? Did you check in the fvOptions if there is something you could reuse, or in other solvers?
Hi Augustin Villa,
I am very much obliged to hear from you!!

PHP Code:
 fvScalarMatrix ElsaSigmaPrimeEqn
        
(
            
fvm::ddt(SIGMA[counter])
            + 
fvm::div(phi,SIGMA[counter],sigmaScheme)
            - 
fvm::laplacian
            
(
            
Dab alphatab*turbulence->nut(), SIGMA[counter],
            
"laplacian(Dab,ElsaSigmaPrime)"
            
)
            -
Foam::sqrt((2/qWiener)*alphatab*turbulence->nut())*(fvc::grad(SIGMA[counter]) & dWdt[counter])
            ==  
SourceElsa
        
); 
I want to calculate the source term in RHS side mentioned in the above equation. Now I am calculating source term in each cell using forAll loop if X(1-X)>0.001 and zero value for source term in the remaining portion of the domain. Whether is this correct way of assigning a source to all cells??

Best Wishes,
Vivek
vivek05 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
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 04:50
Source Term due to evaporation in energy transport equation styleworker OpenFOAM Programming & Development 3 September 7, 2022 04:09
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 18:34
Trouble compiling utilities using source-built OpenFOAM Artur OpenFOAM Programming & Development 14 October 29, 2013 11:59
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 02:24


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