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

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

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 1 Post By virginie_e
  • 3 Post By deepsterblue
  • 2 Post By deepsterblue
  • 1 Post By wendywu

Reply
 
LinkBack Thread Tools Search this Thread 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: 17
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
atulkjoy likes this.
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: 403
Rep Power: 25
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, atulkjoy and sdutta like 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: 403
Rep Power: 25
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

atulkjoy and sdutta like this.
__________________
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: 17
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, 11:30
Default How to begin with OpenFOAM?
  #5
Member
 
xianghong wu
Join Date: Mar 2009
Posts: 57
Rep Power: 17
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
atulkjoy likes this.
wendywu 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
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 01:35
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 20:21.