CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Please give advice and help for the change the x y and z in U (https://www.cfd-online.com/Forums/openfoam-solving/60373-please-give-advice-help-change-x-y-z-u.html)

liugx212 December 17, 2005 16:21

Dear all: I want to modify
 
Dear all:

I want to modify the x, y and z value of U. What do I do? Could you please give help?

Thank you very much,
xiang

alberto December 18, 2005 08:35

If you mean the U components o
 
If you mean the U components of the initial condition, open the

/case_name/0

directory and edit the U file according to your needs.

Alberto

alberto December 18, 2005 08:38

Sorry, read "initial condition
 
Sorry, read "initial condition" as "initial or baoundary conditions".

liugx212 December 18, 2005 13:24

Dear Alberto Passalacqua: T
 
Dear Alberto Passalacqua:

Thanks a lot.
I have read the initial value. I mean I want to change them after read in icoFoam.C. And I have add the code. But some errors is here when I run it. Could you please give more help.

code:
// modifying the value of the U
volScalarField Ux = U.component(vector::X);
volScalarField Uy = U.component(vector::Y);
volScalarField Uz = U.component(vector::Z);

const vectorField& centers = mesh.C().internalField();
forAll (centers, celli)
{
double angle = 180;
Ux = Ux*Foam::sin(angle);
Uy = Uy*Foam::cos(angle);
Uz = 0;
}

error:

--> FOAM FATAL ERROR : Different dimensions for =
dimensions : [0 1 -1 0 0 0 0] = [0 0 0 0 0 0 0]


From function dimensionSet::operator=(const dimensionSet& ds) const
in file dimensionSet/dimensionSet.C at line 158.

FOAM aborting

Aborted


Thank you very much.
xiang

niklas December 19, 2005 02:15

There are two major mistakes i
 
There are two major mistakes in the above code.
First, you are working on a copy of the U field.
what you probably want is to create a reference.
You should then use volScalarField& instead.

Second, you are looping over the cells which probably means that you want to get the cell values,i.e
Ux[celli] = U[celli].component(vector::X) etc...

third, Xian you have posted an identical question on another topic (under a really useles topic since it applies on every post in here), this is REALLY bad. Now we have 2 forums to talk about the same thing and you have done this before: I am begging you on my knees.
Please dont do it again or you will go on my ignore list.

N

liugx212 December 19, 2005 22:45

Dear Niklas Nordin: Thanks
 
Dear Niklas Nordin:

Thanks a lot.

You are right. But I only worry nobody to see. Since somebody were noticed, I surely do as you said.

Thanks again.


All times are GMT -4. The time now is 06:02.