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

transforming a function defined on mesh().points() into a pointScalarField

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By deepsterblue

Reply
 
LinkBack Thread Tools Display Modes
Old   March 26, 2009, 07:49
Default transforming a function defined on mesh().points() into a pointScalarField
  #1
Member
 
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 8
virginie_e is on a distinguished road
Hello Foamers,

I am new to programming in OpenFOAM and I have created a function which is gives a certain value for each of the points of the mesh (mesh().points()) and I would to transform it in a pointScalarField so that I could see the values of the function with paraview. How would you advise me to do that?

Thank you.

Virginie
virginie_e is offline   Reply With Quote

Old   March 26, 2009, 10:27
Default
  #2
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 386
Rep Power: 15
deepsterblue will become famous soon enough
Virginie,

Perhaps this would be helpful:

Code:
#include "pointMesh.H"
#include "pointFields.H"
#include "fixedValuePointPatchFields.H"

        // Instantiate a pointMesh object
        pointMesh pMesh(mesh);

        pointScalarField pValues
        (
            IOobject
            (
                "pValues",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            pMesh,
            dimensionedVector("scalar", dimless, 0.0),
            "zeroGradient"
        );

        pValues.internalField() = myPointField;
    
        pValues.write();
where myPointField is a field that is points-big.

Cheers,
Sandeep
fumiya likes this.
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   March 26, 2009, 10:29
Default
  #3
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 386
Rep Power: 15
deepsterblue will become famous soon enough
Sorry... Cut'n'Paste error:

dimensionedVector("scalar", dimless, 0.0)

should be
dimensionedScalar("scalar", dimless, 0.0)

Cheers,
Sandeep

__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   March 26, 2009, 11:13
Default
  #4
Member
 
Virginie Ehrlacher
Join Date: Mar 2009
Posts: 52
Rep Power: 8
virginie_e is on a distinguished road
Thank you a lot Sandeep.
It works perfectly fine.

Virginie
virginie_e is offline   Reply With Quote

Old   March 31, 2009, 10:30
Default How to begin with OpenFOAM?
  #5
Member
 
xianghong wu
Join Date: Mar 2009
Posts: 57
Rep Power: 8
wendywu is on a distinguished road
Hi,

I am a beginner, I am going to read OpenFOAM code and modify it for purpose of simulating aluminum extrusion. I think maybe OpenFOAM can mesh complex geometry already, but I didn't try. So I think the first step is to modify the constitutive model. When I read the code, there are so many files. I think I should understand the whole structure of the software.But it is so big. So where can I start with? Anybody can give me some advice?

Wendy
wendywu is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
BlockMesh FOAM warning gaottino OpenFOAM Native Meshers: blockMesh 7 July 19, 2010 14:11
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00


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