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

Syntax of codedFixedValue

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 23, 2021, 15:07
Default Syntax of codedFixedValue
  #1
Member
 
Join Date: Mar 2021
Posts: 39
Rep Power: 5
trailer is on a distinguished road
Hello to all,


I would like to clarify something.



I would like to have a codedFixedValue boundary condition on 3 patches, all with the same condition.


What is the correct syntax to do this:


Form 1:


Code:
"(patch1|patch2|patch3)"
    {                                                               
       type        codedFixedValue;                
       value       uniform 0;                     
                                                   
       name        myCustomBoundary;                             
                                                   
       code                                        
       #{                                                                                             
           const fvPatch& boundaryPatch = patch(); 

           const vectorField& Cf = boundaryPatch.Cf(); 
                                                             
           scalarField& field = *this;                                    
                                                                                        
           // Loops over the patch                 
           forAll(Cf, faceI)                       
           {                                       
                const scalar x = Cf[faceI].component(0); 

                field[faceI] = x; 
           } 
        #}; 
    }
Form 2:
Code:
patch1
    {                                                               
       type        codedFixedValue;                
       value       uniform 0;                     
                                                   
       name        myCustomBoundary_a;                             
                                                   
       code                                        
       #{                                                                                             
           const fvPatch& boundaryPatch = patch(); 

           const vectorField& Cf = boundaryPatch.Cf(); 
                                                             
           scalarField& field = *this;                                    
                                                                                        
           // Loops over the patch                 
           forAll(Cf, faceI)                       
           {                                       
                const scalar x = Cf[faceI].component(0); 

                field[faceI] = x; 
           } 
        #}; 
     }


patch2
    {                                                               
       type        codedFixedValue;                
       value       uniform 0;                     
                                                   
       name        myCustomBoundary_b;                             
                                                   
       code                                        
       #{                                                                                             
           const fvPatch& boundaryPatch = patch(); 

           const vectorField& Cf = boundaryPatch.Cf(); 
                                                             
           scalarField& field = *this;                                    
                                                                                        
           // Loops over the patch                 
           forAll(Cf, faceI)                       
           {                                       
                const scalar x = Cf[faceI].component(0); 

                field[faceI] = x; 
           } 
        #}; 
    }


patch3
    {                                                               
       type        codedFixedValue;                
       value       uniform 0;                     
                                                   
       name        myCustomBoundary_c;                             
                                                   
       code                                        
       #{                                                                                             
           const fvPatch& boundaryPatch = patch(); 

           const vectorField& Cf = boundaryPatch.Cf(); 
                                                             
           scalarField& field = *this;                                    
                                                                                        
           // Loops over the patch                 
           forAll(Cf, faceI)                       
           {                                       
                const scalar x = Cf[faceI].component(0); 

                field[faceI] = x; 
           } 
        #}; 
    }

Are they interchangeable?

Sorry is this is too basic!
trailer is offline   Reply With Quote

Old   July 24, 2021, 07:17
Default
  #2
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 802
Blog Entries: 1
Rep Power: 18
dlahaye is on a distinguished road
Yes, interchangeable.
dlahaye 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
UDF syntax error Ratel Fluent UDF and Scheme Programming 4 May 23, 2015 06:15
what is syntax error : missing ')' before ';' aleisia Fluent UDF and Scheme Programming 8 March 10, 2015 16:42
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 08:24
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16


All times are GMT -4. The time now is 17:27.