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

how to rename a field defined from others fields ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2012, 09:34
Default how to rename a field defined from others fields ?
  #1
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Hi!

I defined a symmetric tensor field symGradU from a field U
Code:
volSymmTensorField symGradU = twoSymm(fvc::grad(U));
When I plot the field name using
Code:
Info << "Field symGradU name = " << symGradU.name() << endl;
I get
Field symGradU name = twoSymm(grad(U))

I want to change this name ("symGradU"), in particular to write the output correctly. I tried
Code:
 symGradU.name() = "symGradU" ;
but it doesn't work.

Do you know a simple manner to rename a field ??

Regards,
Cyp
Cyp is offline   Reply With Quote

Old   April 26, 2012, 10:50
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 21
marupio is on a distinguished road
You can do it during construction, (though it must be possible to do it afterwards too...). From GeometricField.H:

Code:
        //- Construct as copy resetting IO parameters
        GeometricField
        (
            const IOobject&,
            const GeometricField<Type, PatchField, GeoMesh>&
        );

        //- Construct as copy resetting name
        GeometricField
        (
            const word& newName,
            const GeometricField<Type, PatchField, GeoMesh>&
        );
So you could use:

Code:
    volSymmTensorField symGradU
    (
        "symmGradU",
        twoSymm(fvc::grad(U))
    );
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   April 26, 2012, 11:32
Default
  #3
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Thank you very much ! It is exactly what I was looking for !
Cyp 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
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 04:49
Need help evaluating field by interpolation with a "lookup table" JohnRHawk OpenFOAM Programming & Development 2 June 28, 2011 13:27
Vector Fields and Operators on the Boundary Noggin OpenFOAM Programming & Development 3 February 17, 2011 10:43
writing fields with field types "kqRWallFunction" ubaid OpenFOAM 0 October 2, 2010 14:22
Flow field measurement in turbomachinery! Wanlai Lin Main CFD Forum 3 September 3, 1999 12:06


All times are GMT -4. The time now is 17:28.