CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Problems with finding normalized mean wind speed (http://www.cfd-online.com/Forums/openfoam-solving/71339-problems-finding-normalized-mean-wind-speed.html)

Alicelin December 26, 2009 13:22

Problems with finding normalized mean wind speed
 
Dear all,

I just got some problems when writing codes for an application to generate the normalized mean wind speed...the following are the codes:

#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RASModel/RASModel.H"

int main(int argc, char *argv[])

{

# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
for (runTime++; !runTime.end(); runTime++)
{
volScalarField Unorm=(1/9.9)*mag(U);
Unorm.write();
runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;

Info<< "End\n" << endl;

}

return(0);
}

.................................................. .................................................. ........................

The above are the codes.....when I tried to execute this application, I got the following error:
"Reading field U

Cannot open file"

I wonder if there's anything wrong with my codes??
Thanks!!

Alice

gwierink December 28, 2009 04:14

Hi Alice,

The error message says the solver cannot open file U. Do you have a case set up with a file 0/U?

Alicelin December 28, 2009 22:20

Dear gwierink,

Yes I do have the file 0/U, but I don't know why I still can't run the application...:(

Regards,
Alice

gwierink December 29, 2009 04:47

Dear Alice,

Are you modifying a solver? Is the code you posted above all code you're compiling and running? Because if it is all code, you're seemingly not solving any equations for U (or p), just calculating Unorm for one time step ...
Can you insert your part of the code (the part about Unorm) into an existing solver, save it under a different name, compile it, and see if it runs?

roth December 29, 2009 08:09

funkySetFields
 
How about funkySetFields? i.e. something like (untested):
Code:

funkySetFields -create -field Unorm -time 0 -expression 'mag(U)/9.9'
Otherwise, if you want to go the roll-your-own route, try modifying a working utility that operates on U e.g. "vorticity", code found in
Code:

OpenFOAM\OpenFOAM-1.6.x\applications\utilities\postProcessing\velocityField\vorticity\vorticity.C
Mike

Alicelin January 8, 2010 03:09

Dear gwierink and Mike,

Thanks for your help! I want to ask one more question: is there a utility called "magU" in OpenFOAM-1.5 ?

Regards,

Alice

gwierink January 8, 2010 04:07

Hi Alice,

I would use mag(U) to get the magnitude of U. But of course you could write something like volScalarField magU = mag(U), to use magU in an equation for better readability.

Alicelin January 18, 2010 04:51

Dear gwierink,

Thanks for your advice:)

Alice


All times are GMT -4. The time now is 11:56.