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

vectorCodedSource - only the x-component?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 11, 2018, 11:44
Default vectorCodedSource - only the x-component?
  #1
New Member
 
Craig White
Join Date: Nov 2013
Posts: 11
Rep Power: 12
DSMC123 is on a distinguished road
Hi,

I have a working vectorCodedSource:

Code:
momentumSource
{
    type            vectorCodedSource;
    active          on;
	selectionMode   cellSet;
	cellSet        ionicWindRegion;

    vectorCodedSourceCoeffs
    {
		fieldNames (U);
		redirectType    velocitySource;

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

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

               codeSetValue
              #{
                        Pout<< "**codeSetValue**" << endl;
			cellSet selectedCells(mesh_, cellSetName_);
			labelList cells = selectedCells.toc();
			vectorField values(cells.size());

			forAll(cells, i)
			{
				scalar ccX = mesh_.cellCentres()[cells[i]].x()*1000.0;
				scalar ccY = mesh_.cellCentres()[cells[i]].y()*1000.0;

				scalar Umax = someEquation;

				scalar Unorm = someOtherEquation;

				scalar Ux = Umax*Unorm;

				values[i] = Ux;
				values[i].y() = 0.0;
				values[i].z() = 0.0;
			}

			eqn.setValues(cells, values);
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        #{
            $codeInclude
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }
    
//     sourceTimeCoeffs
    velocitySourceCoeffs
    {
    // Dummy entry
    }
  
}
This works as expected, but ideally I would only constrain the x-component of velocity, I get a nonphysical looking velocity field because it keeps setting the y-component to zero inside the cellSet. Is it possible to only constrain one component of the velocity? If I don't set all 3 components, I of course get runtime errors.

Thanks!

Last edited by DSMC123; September 12, 2018 at 07:25.
DSMC123 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
Error message: Insufficient Catalogue Size Paresh Jain CFX 33 August 16, 2024 06:09
Error running openfoam in parallel fede32 OpenFOAM Programming & Development 5 October 4, 2018 17:38
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Momentum source coefficient, cylindrical coordinates, circumferential component? polakse CFX 15 January 18, 2016 03:40
UDF component in Cyliderical Velocity? Hongchan Kim FLUENT 3 April 24, 2001 13:20


All times are GMT -4. The time now is 04:54.