MAPDL one-way FSI

Hi there,

I hope you are doing well. I am currently trying to perform a one-way FSI in ansys APDL but am struggling with making the files containing the pressure per frequency and per node. I tried to make a script that saves the pressures like this:
Node #, Freq1, Freq2,...

But because the amount of Freqs changes per model I started doing it different, like this:
Filename: F_%Freq#%_real
Node #, real

Filename: F_%Freq#%_imag
Node #, image

I tried to do this like this:
/POST1

CMSEL, S, F_WALLS
*GET, nodeCount, NODE, , COUNT ! Get total number of nodes in walls
*DIM, nodeList, ARRAY, nodeCount ! Define array for node numbers (index 1 to nodeCount)
*VGET, nodeList, NODE, , NLIST ! Get list of nodes in walls

*GET, NumFreq, ACTIVE, , SET, NSET, 1 ! Get total number of frequency points
NumFreq = NumFreq / 2

*DIM, contPresArray_real, ARRAY, nodeCount ! Create array for real pressure data
*DIM, contPresArray_imag, ARRAY, nodeCount ! Create array for imaginary pressure data

*DO, freq_iter, 1, NumFreq, 1
/POST1
SET, 1, freq_iter,,0 ! Set current frequency result
*GET, myfreq_now, ACTIVE, 0, SET, FREQ ! Get frequency

/POST26
NSOL, 2, nodeList, PRESS  ! Extract nodal pressure for all nodes at once
*VGET, contPresArray_real(1), 2, , 0  ! Get real part of pressure

*CFOPEN, F_%freq_iter%_real_v4, csv
*VWRITE, (nodeList(I), contPresArray_real(I)), I = 1, nodeCount
%I, %F16.6
*CFCLOS

*ENDDO

*DO, freq_iter, 1, NumFreq, 1
/POST1
SET, 1, freq_iter,,1 ! Set current frequency result for imaginary part
*GET, myfreq_now, ACTIVE, 0, SET, FREQ ! Get frequency

/POST26
NSOL, 2, nodeList, PRESS  ! Extract nodal pressure for all nodes at once
*VGET, contPresArray_imag(1), 2, , 1  ! Get imaginary part of pressure

*CFOPEN, F_%freq_iter%_imag_v4, csv
*VWRITE, (nodeList(I), contPresArray_imag(I)), I = 1, nodeCount
%I, %F16.6
*CFCLOS

*ENDDO

And it kinda works, but I don't think I get the correct imaginary numbers. It also takes forever because of the NSOL command in the loop. Can someone see how to do this more efficiently, and see the error?

Kind regards,

Michael

Tagged:

Answers

  • Mac2001
    Mac2001 Member Posts: 5
    First Comment
    **

    I have changes a bit, it is not this far:
    /POST1

    CMSEL, S, F_WALLS
    *GET, nodeCount, NODE, , COUNT ! Get total number of nodes in walls
    *DIM, nodeList, ARRAY, nodeCount ! Define array for node numbers
    *VGET, nodeList, NODE, , NLIST ! Get list of nodes in walls
    /COM, This is the nodelist: %nodeList%

    *GET, NumFreq, ACTIVE, , SET, NSET, 1 ! Get total number of frequency points
    NumFreq = NumFreq / 2

    *DIM, contPresArray_real, ARRAY, nodeCount, 1 ! Create a 2D array for real pressure data
    *DIM, contPresArray_imag, ARRAY, nodeCount, 1 ! Create a 2D array for imaginary pressure data

    *DO, freq_iter, 1, 1!NumFreq, 1
    /post1
    SET, 1, freq_iter!,,0 ! Set current frequency result
    *GET, myfreq_now, ACTIVE, 0, SET, FREQ ! Get freq
    *CFOPEN, F_%freq_iter%, csv
    /POST26
    *DO, node_iter, 1, nodeCount, 1
    NSOL, 2, nodeList(node_iter), PRESS ! Extract nodal pressure
    VGET, press_real, 2, , 0 ! Get real part of pressure
    VGET, press_imag, 2, , 1 ! Get imag part of pressure
    *VLEN, 3
    *VWRITE, nodeList(node_iter),press_real(freq_iter),press_imag(freq_iter)
    %i,%G16.6,%G16.6
    *ENDDO
    /COM, This is the press_real(freq_iter)= %press_real(freq_iter)%
    /COM, This is the press_imag(freq_iter)= %press_imag(freq_iter)%

    *CFCLOS
    

    *ENDDO

    And I do get some values. However, these values contain two points (.). Can someone see why this is the case?

    " 75530" 10.191262716.6 -1.489196396E-1116.6
    " 75540" 10.803392816.6 -1.313645879E-1016.6
    " 75550" 11.971829716.6 -5.273487672E-1016.6
    " 75540" 10.191262716.6 -1.489196396E-1116.6
    " 75550" 10.803392816.6 -1.313645879E-1016.6

    Thanks in advance for your help!