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

Fixing U with vectorCodedSource via fvOptions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 21, 2020, 18:36
Default Fixing U with vectorCodedSource via fvOptions
  #1
Senior Member
 
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 114
Rep Power: 6
Tibo99 is on a distinguished road
Hi foamers,

I try to fix the value of U at the first cell of the domain (from the wall) via the fvOptions framework by using the function ''vectorCodedSource'.

I don't know what I'm doing wrong. The turbulence model compute and I don't get any message of error whatsoever.

But, when I look at the result during the couple of first iteration, the value of U at the specify cell is not what I fixed.

I used the 'topoSetDict' in order to make a selection of the cells that I want to apply the condition on.

To put you in context, in order to simplify the problem, I applied the fix value at the first cell center to a 1D simulation first (the domain is x=1mm, y=150mm(dy=1mm), z=1mm) and then, it will extend to a 2D simulation after. The value of U will be determine by a formula later on.

If you guys have suggestions, let me know. It would be really appreciated!

Here are the code:

topoSetDict:
Code:
actions
(
    // U firstCellFix
    {
        name    firstCellFixU;
        type    cellSet;
        action  new;
        source  boxToCell;
        box     (0 0 0) (0.001 0.001 0.001);
    }
    {
        name    firstCellU;
        type    cellZoneSet;
        action  new;
        source  setToCellZone;
        set     firstCellFixU;
    }

);
fvOptions files:
Code:
fixU
{
    type				vectorCodedSource;
    active				true;
    selectionMode                       cellSet;
    cellSet				firstCellU;
    fields				(U);
    name				Ufix;
    
    codeSetValue
    #{
    
			cellSet selectedCells(mesh_, cellSetName_);
			labelList cells = selectedCells.toc();
			vectorField values(cells.size());
			
			
		forAll(cells, i)
		{	
			values[i].x() = 1.458;
			values[i].y() = 0.0;
			values[i].z() = 0.0;
		};			
    
		eqn.setValues(cells, values);
		
    #};    

}

Thank you very much for your helps!

Last edited by Tibo99; July 21, 2020 at 22:16.
Tibo99 is offline   Reply With Quote

Old   January 20, 2022, 15:48
Default
  #2
Senior Member
 
Join Date: Jan 2019
Posts: 125
Blog Entries: 1
Rep Power: 0
Michael@UW is on a distinguished road
Dear René,
Did you solve the problem? I tried to fix the velocity at some specific cells but failed. It seems the velocity is changed by setValues(cells, values), but it is not the value as specified. If you have figured out the issue, could you please share your solution?

Kind regards,
Michael
Michael@UW is offline   Reply With Quote

Old   January 25, 2022, 11:48
Default
  #3
Senior Member
 
René Thibault
Join Date: Dec 2019
Location: Canada
Posts: 114
Rep Power: 6
Tibo99 is on a distinguished road
I was able to make it work, but maybe its not the way you looking for.

Hope this will help you.

topoSetDict:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1906                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      topoSetDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
    // U firstCellFix
    {
        name    firstCellFixU;
        type    cellSet;
        action  new;
        source  boxToCell;
        box     (0 0 0) (0.001 0.001 0.001);
    }
    {
        name    firstCellU;
        type    cellZoneSet;
        action  new;
        source  setToCellZone;
        set     firstCellFixU;
    }

);

// ************************************************************************* //
fvOptions:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1906                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

fixU
{
	type				vectorFixedValueConstraint;
	active				true;    
	
	selectionMode		cellZone;
	cellZone			firstCellU;	
    volumeMode			absolute;
    
    fieldValues
	{
		U	(5.1053110026 0 0);
	}
}

// ************************************************************************* //
Tibo99 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
Can I use fvOptions to couple a solid region and a fluid region? titanchao OpenFOAM Running, Solving & CFD 4 January 14, 2022 08:55
cannot use fvOptions vectorCodedSource in parallel simulation Sgs OpenFOAM Running, Solving & CFD 3 October 13, 2020 01:36
What are the units used in the thermophysicalProperties and fvOptions dictionaries? ophr OpenFOAM Pre-Processing 2 June 16, 2019 02:29
Configuration of boundary conditions and fvOptions file Raza Javed OpenFOAM Running, Solving & CFD 16 May 3, 2019 17:35
cellSet volume in fvOptions pablo_fil OpenFOAM Running, Solving & CFD 6 April 21, 2017 05:47


All times are GMT -4. The time now is 22:34.