get cel of a volume region zone
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
get cel of a volume region zone
Hello,
I have several sub domains (volume regions) in which I would like to add dedicated source terms.
I wonder if in the cs_source_terms routine I can select the cells of each volume region using something like a get cel of the "izone" corresponding to the desired volume region.
Thanks in advance.
Best regards,
daniele
I have several sub domains (volume regions) in which I would like to add dedicated source terms.
I wonder if in the cs_source_terms routine I can select the cells of each volume region using something like a get cel of the "izone" corresponding to the desired volume region.
Thanks in advance.
Best regards,
daniele
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: get cel of a volume region zone
Hello,
The izone id only exists for specific physics, or temporarily in the GUI (actually, in version 5.0, it is generalized, but I beleive you are using 4.0).
But you can use the same volume selection criteria (zones in the GUI, or "getcell" in user subroutines) to select different zones. If you are using multiple zones, always select them in the same order, so the counts are correct (in 5.0 we have made this easier for head losses, but did not have the time to do it for zones).
Hoping I understood your question correctly.
Best regards,
Yvan
The izone id only exists for specific physics, or temporarily in the GUI (actually, in version 5.0, it is generalized, but I beleive you are using 4.0).
But you can use the same volume selection criteria (zones in the GUI, or "getcell" in user subroutines) to select different zones. If you are using multiple zones, always select them in the same order, so the counts are correct (in 5.0 we have made this easier for head losses, but did not have the time to do it for zones).
Hoping I understood your question correctly.
Best regards,
Yvan
Re: get cel of a volume region zone
Dear Yvan,
I do have multiples domains, and I would simply like to know how I can select them (i.e. all the cells of a given domain) through a getcell. The aim is actually to impose head losses inside a specific domain.
How do I call a zone number inside a routine?
Thank you in advance.
Best regards,
daniele
I do have multiples domains, and I would simply like to know how I can select them (i.e. all the cells of a given domain) through a getcell. The aim is actually to impose head losses inside a specific domain.
How do I call a zone number inside a routine?
Thank you in advance.
Best regards,
daniele
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: get cel of a volume region zone
Hello,
You cannot call a zone number inside getcel (at least nit in version 4.0; in 5.0 you have zones...).
Si you need to call getcel with the same groupe and/or geimetry selection criteria used to define the zones, in a similar order...
Best regards,
Yvan
You cannot call a zone number inside getcel (at least nit in version 4.0; in 5.0 you have zones...).
Si you need to call getcel with the same groupe and/or geimetry selection criteria used to define the zones, in a similar order...
Best regards,
Yvan
Re: get cel of a volume region zone
Hello,
I don't understand what you mean by "geometry selection criteria used to define the zones".
I didn't define any zone, the mesh was imported with subdomains already created...
(By the way, I asked for the installation of the v5.0!)
Thanks in advance.
Best regards,
Daniele
I don't understand what you mean by "geometry selection criteria used to define the zones".
I didn't define any zone, the mesh was imported with subdomains already created...
(By the way, I asked for the installation of the v5.0!)
Thanks in advance.
Best regards,
Daniele
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: get cel of a volume region zone
Hello,
Groups may be pre-built in the mes, but volume selections are not created automatically in the code unless you explicitely require it or import boundary conditions from the preprocessor log or from Salome.
So I assume if you have groups named g1 and g2 for example, you simply need to call getcel('g1') or getcel('g2') but am not sure. Could you post the relevant user subroutines, as well as current listing ?
Regards,
Yvan
Groups may be pre-built in the mes, but volume selections are not created automatically in the code unless you explicitely require it or import boundary conditions from the preprocessor log or from Salome.
So I assume if you have groups named g1 and g2 for example, you simply need to call getcel('g1') or getcel('g2') but am not sure. Could you post the relevant user subroutines, as well as current listing ?
Regards,
Yvan
Re: get cel of a volume region zone
Hello,
Thank you, that was much easier than what I thought: getcel(‘group_name’,…) works fine.
I am trying to use the cs_user_head_losses.f90 provided in the EXAMPLES(v4.3).
I barely copied the way of selecting cells and calculate the head loss tensor from the example, and tried to apply it to my case, just to see if it works.
The routine causes the following error:
SIGSEGV signal (forbidden memory area access) intercepted!
Call stack:
1: 0x40176e <cs_user_head_losses_+0x1b2> (cs_solver)
After some tests, I found that the error comes from the definition of the ckupdc (deleting these lines eliminates the error). The complete subroutine is attached. The concerned lines are:
do ielpdc = 1, ncepdp
iel=icepdc(ielpdc)
vit = sqrt(cvara_vel(1,iel)**2 + cvara_vel(2,iel)**2 + cvara_vel(3,iel)**2)
ckupdc(ielpdc,1) = 10.d0*vit
ckupdc(ielpdc,2) = 0.d0*vit
ckupdc(ielpdc,3) = 0.d0*vit
enddo
First of all, I cannot understand why the example uses ckupdc(ielpdc,1) instead of ckupdc(iel,1).
But, anyway, even with the ckupdc(iel,1) I get the same error.
Do you have any idea of the cause of the error?
By the way, from the numerical point of view, what is the difference between adding a momentum source term in the form S = A*abs(U)*U employing the cs_user_head_losses.f90 rather than the cs_user_source_terms.f90 (with a zero explicit term)?
Thanks a lot in advance.
Best regards,
Daniele
Thank you, that was much easier than what I thought: getcel(‘group_name’,…) works fine.
I am trying to use the cs_user_head_losses.f90 provided in the EXAMPLES(v4.3).
I barely copied the way of selecting cells and calculate the head loss tensor from the example, and tried to apply it to my case, just to see if it works.
The routine causes the following error:
SIGSEGV signal (forbidden memory area access) intercepted!
Call stack:
1: 0x40176e <cs_user_head_losses_+0x1b2> (cs_solver)
After some tests, I found that the error comes from the definition of the ckupdc (deleting these lines eliminates the error). The complete subroutine is attached. The concerned lines are:
do ielpdc = 1, ncepdp
iel=icepdc(ielpdc)
vit = sqrt(cvara_vel(1,iel)**2 + cvara_vel(2,iel)**2 + cvara_vel(3,iel)**2)
ckupdc(ielpdc,1) = 10.d0*vit
ckupdc(ielpdc,2) = 0.d0*vit
ckupdc(ielpdc,3) = 0.d0*vit
enddo
First of all, I cannot understand why the example uses ckupdc(ielpdc,1) instead of ckupdc(iel,1).
But, anyway, even with the ckupdc(iel,1) I get the same error.
Do you have any idea of the cause of the error?
By the way, from the numerical point of view, what is the difference between adding a momentum source term in the form S = A*abs(U)*U employing the cs_user_head_losses.f90 rather than the cs_user_source_terms.f90 (with a zero explicit term)?
Thanks a lot in advance.
Best regards,
Daniele
- Attachments
-
- cs_user_head_losses.f90
- (8 KiB) Downloaded 335 times
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: get cel of a volume region zone
Hello,
The last part (setting ckupdc) must only be done in the 3rd call:
Best regards,
Yvan
The last part (setting ckupdc) must only be done in the 3rd call:
Code: Select all
if (iappel.eq.3) then
do ielpdc = 1, ncepdp
iel=icepdc(ielpdc)
vit = sqrt(cvara_vel(1,iel)**2 + cvara_vel(2,iel)**2 + cvara_vel(3,iel)**2)
ckupdc(ielpdc,1) = 10.d0*vit
ckupdc(ielpdc,2) = 0.d0*vit
ckupdc(ielpdc,3) = 0.d0*vit
enddo
endif
Yvan
Re: get cel of a volume region zone
Thank you Yvan.
The routine is ok now, but it seems not to be taken into account by the code. Actually, changing the head loss value in the main direction does not affect the results (the values of pressure are always the same)...
I tried both with the "Head losses" activated and not activated for the Zones in the GUI.
Do I have to activate the Head Losses somehow to get the cs_head_losses.f90 taken into account?
Thanks in advance.
Best regards,
Daniele
The routine is ok now, but it seems not to be taken into account by the code. Actually, changing the head loss value in the main direction does not affect the results (the values of pressure are always the same)...
I tried both with the "Head losses" activated and not activated for the Zones in the GUI.
Do I have to activate the Head Losses somehow to get the cs_head_losses.f90 taken into account?
Thanks in advance.
Best regards,
Daniele
-
- Posts: 4209
- Joined: Mon Feb 20, 2012 3:25 pm
Re: get cel of a volume region zone
Hello,
The user subroutine should be enough. Could you add
in the
section to check how many cells were selected ?
Also, how many time steps are you running ? With this formula, the head losses are probably 0 at the first time step.
Best regards,
Yvan
The user subroutine should be enough. Could you add
Code: Select all
print *, 'necpdp = ', ncepdp
Code: Select all
if (iappel.eq.3) then
...
endif
Also, how many time steps are you running ? With this formula, the head losses are probably 0 at the first time step.
Best regards,
Yvan