wiki:Profiles

Version 1 (modified by idilernia, 12 years ago) ( diff )

Profile objects

The profile object provides the option to define a discrete distribution of a determined attribute and transform it into a continuous one using cubic spline interpolation.

The creation of such object is handled by the function createProfile(Profile, nPoints, fields, [mode]) where nPoints is the number of entries in the array, fields is an array that contains an entry for each field, and mode is the type of array (RADIAL, CYLINDRICAL, etc.)

TYPE(ProfileDef), POINTER :: Profile      ! Object pointer
CreateProfile(Profile, 100, (/Mass_Field, P_Field/, RADIAL)    ! Creation of a profile instance

With the following code, we created a radial profile object with 100 entries, each entry will have a position, a mass and a pressure attribute.

To query a profile object the user can make use of the function getProfileValue(position,field,Profile) where position , field is the attribute index that is being looked up, and Profile is a pointer to the queried profile object.

HydroStatic Equilibrium

One possible application of this object is to put a density distribution around a point gravity in hydrostatic equilibrim, that is, when the following criteria is satisfied:

Lets see how to create a profile for a spherically symmetric object (or a column of gas) in hydrostatic equilibrium:

First we need to create a profile object, same procedure shown above:

TYPE(ProfileDef), POINTER :: hseProfile                             
CreateProfile(hseProfile, 100, (/Density_Field, P_Field/), RADIAL)

After the object is created, it needs to be populated with position and density values. This can be accomplished by either reading these values from an external file or creating function to do this.

Here is an example of populating the array from a file:

DO i=1,100                                                       ! Populates array with 100 entries
  READ(PROBLEM_DATA_HANDLE, *) hseProfile%data(i,:)              ! reads values from file
  hseProfile%data(i,:)=hseProfile%data(i,:) / (/lScale, rScale/) ! rescale values to computational units
END DO

Assuming we have populated our profile object with a density profile we can use Profile_PointGravityHSE(Profile, PointGravityObj, p_inf) where PointGravityObj is a pointer to a mass particle at r=0 and p_inf is a value for the pressure at r=∞. This function will calculate the optimal pressure profile needed by an object with the provided the density profile to stay in equilibrium.

You can check the HydroStaticStar module if you want to read about using a profile object to put an ambient in hydrostatic equilibrium.

Note: See TracWiki for help on using the wiki.