# Cylindrical 2d coordinate system

Registered by Brendan Tollit

In geometric 2D it is desired to have an RZ cylindrical coordinate system capability.

Mathematically this adds a 2*pi*r to every term of an time+advection+diffusion+absorption+source equation for both volume and surface integrals (this is explained on wikipedia).

It is proposed here that this is best added in Transform_Elements.F90 via scaling the detwei array by the required term, where the r is evaluated at the quadrature points.

Where appropriate code like the following will appear:

if (present(detwei) then
! If the coordinate system is cylindrical and the geometry dimension
! is 1 or 2 then include 2*pi*r into detwei, where r is the
! first geometry dimension variable. Similarly if the coordinate
! system is spherical and the geometric dimension is 1 then include
! 4*pi*r**2 into detwei, where r is the only geometric dimension variable.
if ( ((dim == 1) .or. (dim == 2)) .and. (coordinate_system == 2) ) then
detwei = detwei * ele_val_at_quad(X, ele, dim = 1) * two_pi
else if ( (dim == 1) .and. (coordinate_system == 3) ) then
detwei = detwei * ele_val_at_quad(X, ele, dim = 1) * ele_val_at_quad(X, ele, dim = 1) * four_pi
end if
end if

Note that this will also include it in 1D, as well as a spherical coordinate system (scale by 4*pi*r**2) for 1D again.

The variables two_pi and four_pi will be added to Global_Parameters.F90.

The variable coordinate_system will be set from an optional option that becomes available if the geometry dimension is set to 2 or 1 in the fluidity schema. Unselected and the default Cartesian coord system is used. The variable coordinate_system is perhaps best added to Global_Parameters also to avoid inspecting spud within Transform_Elements.F90. An integer value will be used to distinguish between choices.

This will take the convention that XY --> RZ, as other parts of the options schema will still refer to X and Y (such as vector field boundary conditions).

Also a procedure to check that the first dimension coordinate (X-->R) has no negative values should also be included.

Suitable additions to the manual will be required as well as a some test cases (compared to analytic and MMS).

## Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Direction:
Needs approval
Assignee:
Definition:
Discussion
Series goal:
None
Implementation: Unknown
Milestone target:
None

(?)

### Work Items

This blueprint contains Public information
Everyone can see this information.

No subscribers.