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

problem with source term

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2022, 16:14
Default problem with source term
  #1
New Member
 
manou mouna
Join Date: Jan 2022
Posts: 7
Rep Power: 4
Manouu is on a distinguished road
Hello, I want to add a volume force to the momentum equation which depends on the position, so I used fvOptions and codedSource, here is the code I used, I have no errors and the solution converges but the source term is not taken into account, what is the problem in the code please??
regards


PHP Code:
volumicForce
{
     
type vectorCodedSource;

    
active true;

   
name volumicForce;

   
vectorCodedSourceCoeffs
  
{
       
selectionMode points;
       
points
       
(
            (
0 0 0)
            (
0 0 0.01)
            (
0 0 0.02)
       );


      
fields (U);
       
fieldNames      (U);

codeInclude
       
#{

       #};

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

codeAddSup
      
#{
          
const scalarField&mesh_.V();

          
vectorFieldFSource eqn.source();

          
vectorField F(mesh_.nCells(), vector(001)); // declare F 

          
scalarField rho2(mesh_.nCells(), scalar(1000.0)); //declare rho2...

     
const labelListcellIDs cell();

Info<<"eqn dimension "<<eqn.dimensions()<<nl// to check the dimesnsions
           
               
forAll(cellIDsi)
        {
                          
label celli cellIDs[i];
                          
FSource[cellI]-= F[cellI]/rho2[cellI]*V[cellI];                    
        }
           
       
#};

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

// Dummy entry. Make dependent on above to trigger recompilation
coded
#{
$codeInclude
$codeCorrect
$codeAddSup
$codeSetValue
#};
}

volumicForceCoeffs
{
selectionMode   all;
}

Manouu 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
Problem of SOURCE term gradient in UDS wind Fluent UDF and Scheme Programming 6 December 1, 2022 14:21
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 08:06
Source term for EVAPORATION in Energy Equ. - technical difficulty ? Kummi OpenFOAM 1 September 9, 2019 09:32
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[Other] How to use finite area method in official OpenFOAM 2.2.0? Detian Liu OpenFOAM Meshing & Mesh Conversion 4 November 3, 2015 03:04


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